最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Yoast makes comment_reply_link function output plain link to comment instead of reply link

programmeradmin0浏览0评论

EDITED - I discovered that my problem only arises when the Yoast plugin is active. But I want to keep Yoast active, so my updated question is: Any idea what to do for comment replies working while Yoast is activated?

Here's my original question:

In a custom theme created by myself, or rather its child theme on a multisite, I am having trouble with the comment_reply_link function. I am using it as follows:

<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

Now on the website, the link doesn't result in the expected /?replytocom=6#respond appended to the URL of the post, but simply in a local #comment-6 href attribute for the link. So when a user clicks on "Reply", nothing happens. When he/she writes a reply then, it is posted as a first-level reply, not as a reply to the intended previous comment.

EDITED - I discovered that my problem only arises when the Yoast plugin is active. But I want to keep Yoast active, so my updated question is: Any idea what to do for comment replies working while Yoast is activated?

Here's my original question:

In a custom theme created by myself, or rather its child theme on a multisite, I am having trouble with the comment_reply_link function. I am using it as follows:

<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

Now on the website, the link doesn't result in the expected /?replytocom=6#respond appended to the URL of the post, but simply in a local #comment-6 href attribute for the link. So when a user clicks on "Reply", nothing happens. When he/she writes a reply then, it is posted as a first-level reply, not as a reply to the intended previous comment.

Share Improve this question edited Jun 11, 2019 at 17:37 Johannes asked Jun 11, 2019 at 17:17 JohannesJohannes 18312 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Version 7 of WordPress SEO by Yoast removes the replytocom variables by default.

We’ve removed the option to turn off the replytocom variable. The replytocom feature in WordPress lets you reply to comments without activating JavaScript in your browser. However, every comment gets is own link and these could all end up in the search engines. So we now remove these variables by default.

To get the replytcom variables back we can add the following filter in our theme's functions.php

add_filter( 'wpseo_remove_reply_to_com', '__return_false' );
发布评论

评论列表(0)

  1. 暂无评论