Remove nofollow from specific internal links

I wrote the following code to address ADDING tag attributes, but here is a version to help you locate, and remove nofollow: add_filter( ‘the_content’, ‘ex1_the_content_filter’ ); function ex1_the_content_filter($content) { // finds all links in your content with a nofollow preg_match_all(‘/\<a .*?”nofollow”.*?a>/’,$content,$matches, PREG_SET_ORDER); // loop through all matches foreach($matches as $m){ // potential link to be … Read more

How to set all external links from a certain user to “nofollow”?

You want to try something like this (untested): // Nofollow in content $author_id = get_the_author_meta( ‘ID’ ); add_filter(‘the_content’, ‘my_nofollow’); function my_nofollow($content) { //return stripslashes(wp_rel_nofollow($content)); return preg_replace_callback(‘/<a[^>]+/’, ‘my_nofollow_callback’, $content); } function my_nofollow_callback($matches, $author_id) { $link = $matches[0]; $site_link = get_bloginfo(‘url’); if ($author_id === 4) { if (strpos($link, ‘rel’) === false) { $link = preg_replace(“%(href=\S(?!$site_link))%i”, ‘rel=”nofollow” $1’, … Read more

Insert nofollow in a “Powered By” link, except in the homepage [closed]

I don’t know if it’s any more elegant, but if you don’t like duplicating the HTML code, you could do this: function prefix_poweredby() { $html=”<a href=”https://example.com””; if ( ! is_front_page() ) { $html .= ‘ rel=”nofollow”‘; } $html .= ‘ target=”_blank”>link</a>’; echo $html; } add_action(‘wp_footer’, ‘prefix_poweredby’);

Force meta data on specific product type

You can try the wp_head hook: add_action( ‘wp_head’, ‘check_for_enviso_group_ticket’ ); function check_for_enviso_group_ticket() { if ( is_product() && ( ‘enviso_group_ticket’ == get_the_terms( get_the_ID(), ‘product_type’ )[0]->slug ) ) { echo ‘<meta name=”robots” content=”noindex,nofollow”/>’, PHP_EOL; } } or to not break your site in case the WooCommerce is disabled and the is_product() function isn’t defined: add_action( ‘wp_head’, ‘check_for_enviso_group_ticket’ … Read more

Noindex,Nofollow in theme’s header.php?

I think not. Because it’s not indexing the result page: See: <?php if (is_search()) { ?> if is Search doesn’t index or follow the page (for example to not show duplicated content). But you can remove the code if you feel you are losing views. I was reading an article about this. Even if WordPress … Read more

How To Remove a Tag?

There shout not be code like <meta name=”robots” content=”noindex,nofollow” /> with default WordPress installation unlike you place a mark for ‘discourage search engines from indexing this site’ with installation or using setting. If it is the case you can do following thing to remove it. Go to Settings > Reading and unmark Discourage Search Engines. … Read more

How to add rel=”nofollow” to wp_list_pages?

use wordpress build in funcion for that “wp_rel_nofollow” with a hook to wp_list_pages. paste this code in your theme’s functions.php file and you are set. function add_no_follow($output){ return wp_rel_nofollow($output); } add_filter(‘wp_list_pages”https://wordpress.stackexchange.com/questions/7688/,”add_no_follow’); hope this helps.