PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, May 16, 2022

[FIXED] How to remove the rel="nofollow" from "cancel reply" in wordpress

 May 16, 2022     wordpress     No comments   

Issue

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);

Solution

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/



Answered By - mikerojas
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing