How to set all external links to a certain domain to "nofollow"?

I am searching for a code or better a wordpress plugin to set automatically all links only to a certain domain (and of course to all of its subpages) to "nofollow". I could not find any plugin which is doing that, maybe you are knowing one or a coding-solution (javascript I guess). F.e. the plugins I found and their problems: https://wordpress.org/plugins/nofollow/ Has only "A nofollow option for individual blogroll links" -> so no possibility to set only a certain domain …
Category: Web

How to change all external links to "nofollow" but only by user role

I am looking for this question How can I nofollow all external links by user role? I have found these codes to convert all links to Nofallow, can anyone change these codes according to the user's role https://www.codespeedy.com/relnofollow-for-all-external-links-in-wordpress-using-code/ // add nofollow to links function nofollow_for_external($content) { $content = preg_replace_callback( '/<a[^>]*href=["|\']([^"|\']*)["|\'][^>]*>([^<]*)<\/a>/i', function($m) { if (strpos($m[1], "domain.com") === false) return '<a href="'.$m[1].'" rel="nofollow">'.$m[2].'</a>'; else return '<a href="'.$m[1].'">'.$m[2].'</a>'; }, $content ); return $content; } add_filter('the_content', 'nofollow_for_external'); // Stop self pingback function disable_self_ping( &$links …
Category: Web

How to restrict access to wp-content, wp-includes and all sub-folders

after searching I didn't find an answer still confused of how do I hide the -> wp-content --> uploads --> themes --> plugins -> wp-includes in browser. What I want is when viewer browse some like this: http://www.mysite.ext/wp-content they will see an error: You don't have permission to access this page. Other said that just upload index.html or index.php with .htaccess in the folder you want to hide. But what if I have many subfolder inside wp-content I will do …
Category: Web

Remove nofollow from specific internal links

I got all my website with a lot of internal cloaked links with a nofollow attribute. I need a function or filter to add inside functions.php that removes the nofollow attribute when the permalink contains a specific word es "/link/pluto". Could you help me? Thanks for your support. Gp
Category: Web

Force meta data on specific product type

I'm working on a Woocommerce website were I have multiple product types: simple_product, enviso_group_offer and enviso_group_ticket. All of these types are just products in my Woocommerce. No I want to add the noindex, nofollow meta tag to only the enviso_group_ticket products. <meta name=”robots” content=”noindex,nofollow”/> How can I achieve that? When I'm using the SEO plugin Yoast, I can only target all the Products, instead of a specific product type. At this moment, I've done it with the following code, but …
Category: Web

Insert nofollow in a "Powered By" link, except in the homepage

I want to insert the nofollow value in a "Powered by" link if the page is different than the homepage. So I have written this: function prefix_poweredby() { if ( is_front_page() ) { $html = '<a href="https://example.com" target="_blank">link</a>'; echo $html; } else { $html = '<a href="https://example.com" rel="nofollow" target="_blank">link</a>'; echo $html; } } add_action('wp_footer', 'prefix_poweredby'); It's working just fine, but I'm pretty sure that there are other more elegant ways to write this function and I would love if you …
Category: Web

Nofollow attribute in Wordpress link embed code?

I am including links to items I've written for clients in a WP post, but want them to be "no follow" to avoid any issues with those same clients. The links are posted as embed code and I'm not sure how or where to add the rel="nofollow" attribute. The code looks like this: <figure class="wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider"><div class="wp-block-embed__wrapper"> https://www.clientssite.com/their-blog-post/ Can you point me in the right direction? Thx
Category: Web

How to automatically nofollow a set domains? (I seem to have half of the answer)

There we go with my first question ever on WPSE. Hope someone can lend me a hand here :) I am sick of adding nofollow rel attribute manually on every single outbount link. I´m looking for a code snippet to make external links going from my blog posts into a specific set of external domains nofollow. This is tricky because I don´t want all external links to become nofollow. Just the ones under specific domains (there´s like 3 domains I …
Category: Web

Editing the Comment Reply Link

Just found this site via the WP-Hackers List, been using WordPress for years (make a living partially thanks to it) and never stumbled on this site! Posted this on the WP-Hackers list, but didn't find a solution. I know WordPress 3.1 has removed the nofollow attribute from the comment Reply link (WordPress 3.1 beta looks good), but was working on something theme wise that should also work with removing the nofollow attribute from the link for WordPress 3.0.3 and below, …
Category: Web

Why does the header set X-Robots-Tag apply to all pages?

The directives below are intended to apply the header X-Robots-Tag noindex and nofollow to a single page. The directives below are applied before the WordPress code block however it appears to result in all pages being set with noindex and nofollow RewriteCond %{REQUEST_URI} ^(.*)?faq?(/)$ [NC] RewriteRule ^faq - [E=NOINDEXNOFOLLOW] Header set X-Robots-Tag "noindex, nofollow" E=NOINDEXNOFOLLOW The E flag is being used for LiteSpeed as opposed to ENV for Apache.
Category: Web

Nofollow external links

Hello guys i am using following code to make all external links nofollow. add_filter('the_content', 'my_nofollow'); add_filter('the_excerpt', 'my_nofollow'); function my_nofollow($content) { return preg_replace_callback('/<a[^>]+/', 'my_nofollow_callback', $content); } function my_nofollow_callback($matches) { $link = $matches[0]; $site_link = get_bloginfo('url'); if (strpos($link, 'rel') === false) { $link = preg_replace("%(href=\S(?!$site_link))%i", 'rel="nofollow" $1', $link); } elseif (preg_match("%href=\S(?!$site_link)%i", $link)) { $link = preg_replace('/rel=\S(?!nofollow)\S*/i', 'rel="nofollow"', $link); } return $link; } But after adding this code in my site's Theme Functions all links are still dofollow. I am using Advanced Custom …
Category: Web

Removing rel="nofollow" from links posted in Post Content

I am running wordpress for my blog EasyPadhai. I am writing a posts and I have included links to my Android app EasyPadhai for my users. But all links to app are turning in nofollow links. Also Social-links are becoming nofollow links. How can I change this, so that links in post_Content become doFollow. I am not a pro-wordpress dev. Also I am using following plugins on my installation. Akismet Google Analytics for WordPress WordPress SEO W3 Total Cache How …
Category: Web

How To Remove a Tag?

I would like to know how to remove the tag nonidex, nofollow from my page header. My website is related to the industry of man and van removal company London.
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.