- This topic has 31 replies, 5 voices, and was last updated 3 years, 7 months ago by
Elvin.
-
AuthorPosts
-
February 17, 2022 at 12:32 pm #2123246
mad2toi
Thank you for your feedback but it does not work with the theme. I need something custom
February 17, 2022 at 6:05 pm #2123494Leo
StaffCustomer Supportbut it does not work with the theme. I need something custom
I can’t see how this would be a theme-related question.
Did you find a solution that works in a Twenty series WP theme environment?
If so the exact same solution should work in GeneratePress.
If you haven’t found a solution yet then I’d recommend checking with WP’s support team on this.
February 17, 2022 at 8:22 pm #2123553mad2toi
Hi yes this code :
add_action( ‘wp_footer’, ‘twentytwentyone_add_ie_class’ );
function dofollow($url) {
$url = str_replace(‘ nofollow’, ”, $url);
return $url;
}
add_filter(‘get_comment_author_link’, ‘dofollow’);But remplace twentytwentyone by ?
Can you solve it please ?
February 17, 2022 at 9:04 pm #2123586Leo
StaffCustomer SupportI don’t think that line does anything.
Have you tried Fernando’s solution here?
https://generatepress.com/forums/topic/internal-links-nofollow/#post-2120444February 17, 2022 at 10:45 pm #2123632mad2toi
Hello, I have already tried but it does not work. Do you have a custom code please?
February 17, 2022 at 11:10 pm #2123657Elvin
StaffCustomer SupportHi there,
Can you share how you’re running the code/s provided? It’s possible the issue is w/ the codes not executing at all.
Let us know.
February 17, 2022 at 11:12 pm #2123662mad2toi
February 17, 2022 at 11:31 pm #2123666Elvin
StaffCustomer SupportI’ve tested all the variations of the code provided and they all worked but to different degrees.
Can you specific which links do you want to specifically change the rel attribute to dofollow?
Is it only for the comment links? Or ALL the links on the site?
Let us know.
reminder: For PHP snippets, please a child theme’s functions.php for a Code Snippets plugin for running PHP codes. Using the Parent theme’s functions.php has a risk of your codes being wiped if you update the theme. Here’s our recommended way of adding PHP – https://docs.generatepress.com/article/adding-php/
February 17, 2022 at 11:48 pm #2123675mad2toi
Thank you for your reply. I have internal nofollow link errors in my web pages.
February 18, 2022 at 12:09 am #2123685Elvin
StaffCustomer SupportTo investigate further:
Can you link us to the specific page where this audit was done? I’ll check the entire page if there are any other link with nofollow aside from the comments.
As for the comments:
Try this PHP snippet:
add_filter( 'get_comment_author_link', 'remove_nofollow_on_comment_links', 20, 3 ); function remove_nofollow_on_comment_links( $return, $author, $comment_ID ){ $comment = get_comment( $comment_ID ); $url = get_comment_author_url( $comment ); $return = '<a href="'.$url.'" rel="external ugc" class"url">'.$author.'</a>'; return $return; }
February 18, 2022 at 12:14 am #2123686mad2toi
The code worked perfect and thank you 🙂 The audited site is madintouch.com
February 18, 2022 at 1:02 am #2123716mad2toi
The code works but creates a conflict on my site. Do you know how to solve the problem?
February 18, 2022 at 1:07 am #2123723Elvin
StaffCustomer SupportThe code itself literally just removes
nofollow
from the rel attribute.These reports are completely unrelated to the code.
Reading some of the text on the image, the context is SEO related. (semantics)
February 18, 2022 at 1:09 am #2123726mad2toi
Do you know how to solve the problem please ?
February 18, 2022 at 1:11 am #2123729Elvin
StaffCustomer SupportDo you know how to solve the problem please ?
You’ll need an SEO plugin for this. 🙂
But as for the actual functionality of the specific SEO plugin you’ll be using, we suggest talking to its support for best practices. 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.