Nofollow attribute in WordPress link embed code?
If you have used anchor tag manually than in post editor switch to html editor, now add rel=”nofollow” in anchor tag like this : <a href=”http://www.example.com” rel=”nofollow” >Click me text</a>
If you have used anchor tag manually than in post editor switch to html editor, now add rel=”nofollow” in anchor tag like this : <a href=”http://www.example.com” rel=”nofollow” >Click me text</a>
Writing a robots.txt is an easy process. Follow these simple steps: Open Notepad, Microsoft Word or any text editor and save the file as ‘robots,’ all lowercase, making sure to choose .txt as the file type extension (in Word, choose ‘Plain Text’ ). Next, add the following two lines of text to your file: User-agent: … Read more
If you want to add rel=”nofollow” to all the links, then you can simply use str_replace(): echo str_replace( ‘<a href=”https://wordpress.stackexchange.com/questions/254676/,”<a rel=”nofollow” href=”, $part_cur_auth_obj->description );
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
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
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’);
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
If you’re experiencing bugs with my own plugin (sem-external-links), be so kind to say how it’s not working…
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
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