回复评论的链接wordpress中损坏的comment_reply_link

问题描述

我使用comment_reply_link()函数创建回复评论链接,但创建的链接已损坏

我使用的脚本:

<?PHP
$argsComment = array(
   'reply_text' => '<img src="'. get_site_url() .'/wp-content/themes/webranko/img/SVG/reply.svg" alt="">','depth' => 1,'max_depth' => 2,);

comment_reply_link( $argsComment,$comment,$post->ID ); ?>

它创建了此链接

<a rel="nofollow" class="comment-reply-link reply replyToThisComment" href="#comment-8" data-commentid="8" data-postid="239" data-belowelement="comment-8" data-respondelement="respond" aria-label="replay to Admin" data-target="c_232">
    <img src="http://my-site.com/wp-content/themes/webranko/img/SVG/reply.svg" alt="">
</a>

href属性应该是链接,而不是评论ID href="#comment-8"

我做了一些更改,我禁用了Yoast SEO Premium插件,并重播了它的工作链接,但是当我激活它时,链接断开了

解决方法

Yoast的版本7默认情况下会删除replytocom变量。 您应该在您的functions.php文件中添加代码

add_filter( 'wpseo_remove_reply_to_com','__return_false' );