In today’s WordPress tutorial, I’m going to show you how to add nofollow to add rel=”nofollow” to links in WordPress. WordPress in itself has a pretty nice link adding system in the WYSIWYG editor, it allows the users to make it so the links open in a new tab, but unfortunately it doesn’t allow us to add a rel=”nofollow” to them.

Luckily there’s a way to add another checkbox to add nofollow as well! Here’s how you can add it to your editor as well.

There are two ways you can add this nofollow checkbox. Either by adding a small js file into your theme files or to your site specific plugin or you can just download and activate a plugin/

Manually Adding the Script

The first method I’m going to show you is a little bit more technical. You’ll need the following wplink.js file.

After you downloaded the zip, extract it, and place the wplink.min.js into either of these locations:

  • Inside your theme’s folder into a folder called “js” ( wp-content/themes/mytheme/js ) replace my theme is the name of the theme you use.
  • If you have a site-specific plugin, then create a folder called “js” in the plugins directory and place it there. ( wp-content/plugins/site-specific-plugin/js ) replace site-specific-plugin with the name of your site-specific plugin’s name.

Now that you have the js file uploaded to your site, you’ll need to add the script to WordPress.

Where you add this following script depends on if you are using your theme or a site-specific plugin.

If you use your theme, then open functions.php inside your theme folder, if you are using a site specific plugin, then open it’s main file. Usually called site-specific-plugin.php

Then, scroll down to the bottom, and add the following php code to the file. Then save the file.

/*    Rel No Follow
===============================================================*/
function overwrite_wplink() {
    // Disable wplink
    wp_deregister_script( 'wplink' );

    // Register a new script file to be linked
    wp_register_script( 'wplink', plugins_url( 'js/wplink.min.js', __FILE__), array( 'jquery', 'wpdialogs' ), false, 1 );
}
add_action( 'admin_enqueue_scripts', 'overwrite_wplink', 999 );

And you are done!

If you used this method, you can skip the plugin one, and go to how to add rel=”nofollow” to links from your post editor.

Using a Plugin

If you decide to use a plugin instead of the manual version, there’s a pretty neat and small plugin for this, called  No Follow All External Links

After you downloaded and activated the plugin, you can proceed to the next step. This plugin will conver all of your external link to nofollow

How to add rel=”nofollow” to links

After you activated the plugin or you’ve added the code into your theme, your new link add popup should look like this:

If you choose the new site-specific plugin method, and for some reason it isn’t working, you can download this as a plugin above.

Click here to read about table press

Leave a Reply

Your email address will not be published. Required fields are marked *