Home > OS >  How to remove the rel="nofollow" from "cancel reply" in wordpress
How to remove the rel="nofollow" from "cancel reply" in wordpress

Time:04-28

I am using this code but I am not getting results, the nofollow is still there.

function remove_nofollowcancel($formatted_link, $link, $text){
 return str_replace("rel='nofollow'", "", $formatted_link );
}
add_filter('cancel_comment_reply_link', 'remove_nofollowcancel', 10, 3);

CodePudding user response:

have you tried reversing the quotes?

 return str_replace('rel="nofollow"', "", $formatted_link );

When looking at the internals of get_cancel_comment_reply_link the rel attribute is using double quotes.

Docs: https://developer.wordpress.org/reference/functions/get_cancel_comment_reply_link/

  • Related