you can add a filter in your functions.php
add
// Nofollow in content
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) {
$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;
}
Related Posts:
- How to add nofollow on all external links without plugin?
- How to set all external links to a certain domain to “nofollow”?
- Can YOAST SEO fields be removed from custom post type [duplicate]
- Should a SEO plugin be necessary? [closed]
- How to generate expiring URL?
- How are plugins in the WordPress plugin directory ranked?
- Open external links in a new window
- Issues creating a tinyMCE plugin that creates a custom link
- How to attach Links into page/post or custom post type?
- Conditional Display of Links in Widgets
- How do I customize my WordPress shortlink structure in link-template.php without a plugin?
- WordPress web page struggling with performance
- add_filter the_content in functions.php not working
- Tag link suggestion plugin
- XML sitemap over product variations
- Regenerate images with automatic ALT and TITLE attributes
- How to set a custom title per language?
- google conversion code
- How to add an image from web-link?
- Removing rel=”nofollow” from links posted in Post Content
- SEO smart plugin not working for words ending with ä, ö, å
- Build a list of partners with Link, Logo and text
- qTranslate conflicts with SEO-plugins [closed]
- Yoast SEO plugin “could detect no serious SEO problems” on dashboard
- WordPress Sitemap including pages that aren’t there
- SEO Friendly URL on dynamic product page produced via shortcode
- install robots.txt to wordpress website admin
- WP Plugin for onpage link suggestions [closed]
- How to add subcategories to the blogroll?
- Check if SEO plugin installed
- Show Sitename on Yoast SEO Title tag [closed]
- Help in using SEO Plugins: SEO Ultimate And Yoast SEO Plugin
- Yoast SEO settings unavailable in an archive page from wordpress plugin
- In Woocommerce theme need to add custom external link [closed]
- how to connect the author profile with google webmaster tools in multiuser blog?
- Yoast Force Rewrite Crashed Site [closed]
- Is changing post from category in a large blog a good practice?
- XML Sitemap Generator can’t notify google and bing
- Adding rel=”nofollow” to external links in posts?
- Why is Google Search Console getting X-Robots-Tag noindex?
- Any idea how to get something like this to work? [closed]
- How to remove index meta tag
- How to integrate together a website currently hosted WordPress.com and a custom web application currently hosted on Azure?
- Site shows URL instead of “meta title” after deleted few plugins (not any SEO plugin was deleted)
- Inserting shortcode in href – any ideas or workarounds?
- Need to change link URL embedded in multiple posts to new link URL
- track all external links on blog via username
- how to replace hostnames on certain external links?
- How to auto strip hyperlinks & images in wordpress post
- Plugin for TinyMCE to create reference to other posts
- Linked pages from plugin on front can’t see $wpdb
- Preserve Search engine index while shifting to new Domain
- How do I fill the Home Description?
- WordPress Sitemap for MSSQL
- custom wordpress theme and yoast seo injecting text in body
- Why the internal link get converted into a comment?
- WordPress built-in compression of images? How well does it compare to Photoshop or Shortpixel?
- WP search box on page not finding .PDF files
- Remove Keywords From Webpage But Still Use for SEO
- Does anyone know why my SEO and title become one?
- How page with random php file with query params generated
- My wordpress local urls is still displayed even moved to live
- .com creates automated link in post
- Writing SEO for Homepage when homepage is set to display latest posts
- Scroll to ID broken in main menu
- SEO Site Title appearing in google search despite not being added
- Facebook sharing image error with facebook debug
- User Affiliate Token Generator?
- Same Title on two different post type with single custom taxonomy
- Add Filter to get_next_posts_link
- Yoast Seo Plugin meta title not showoing [closed]
- How to markup wordpress site using Schema.org?
- Problem with Duplicate Meta / tag description in Webmaster Tool [duplicate]
- Does Google detect files in the WordPress plugin directory
- How to Set Limit with WordPress Get Bookmarks Shortcode
- Can I have a link within a WP UI Spoiler
- Why links are not linked if edited comment?
- How to use Link Manager
- How do I add php to all links automatically?
- How to remove links generated by SEO-smart-links?
- How do I increase the 255 character limit on the ‘description’ field for link library links?
- Thumbnails and Lightbox
- Strange Search Query Appearing on Google Index – “/?q=Save+Us+From+Berlusconi”
- Automatically set posts to NoIndex depending on category?
- Do shortcodes affect page indexing by search engines?
- How to block external download link access if visitor not referred from WP?
- getting image alt text via ACF plugin in WordPress [closed]
- HTML link within my plugin settings page
- Simple Amazon Affiliate Plugin [closed]
- How to make temporary expiring link for a downloadable file
- WordPress Customise
- How should I force WordPress to give proper name for the uploading images?
- Possible to change meta data single quotes to dobule quotes in yoast wordpress seo? [closed]
- Continuous jQuery Slider / Carousel Plugin with linkable slides [for WooCommerce]
- Seo Problems in My meta Discription [closed]
- De-index plugin files
- how to make yoast seo read text from custom fields in custom post type
- Page with redirect
- claim a permalink and all sublinks in plugin
- What is the easiest way to implement cascading database upgrade for my plugin?