WordPress On-Page SEO with the Real-Time Find and Replace Plugin

My favorite SEO-specific plugin is Yoast SEO. Despite all of its features there are still optimizations I like to make and for those I turn to the Real-Time and Replace plugin (I'm the plugin author). This plugin's capabilities are broad, but in this post I'll stick to things that an SEO might want to do.

About the Plugin

This finding and replacing takes place AFTER the WordPress engine has generated a page (i.e. all plugins and scripts have executed), but before that page has been sent out to a user's browser. And since these changes are made on-the-fly without modifying WordPress core files, plugins, or themes, future upgrades to any of these files don't result in you losing your changes. In addition, while these changes aren't saved to the WordPress database, they can be cached by the various WordPress caching plugins so site performance shouldn't be affected.

Real-Time Find and Replace Interface

As you can see in the above screenshot, you're able to specify some text to Find and some text to Replace it with. The find and replace functionality can use simple rules or regular expressions for more complex pattern matching.

Widget plugin authors like to insert links back to their sites. I often remove these links when I think they're abusive. For example, to remove the link that the Photodropper plugin inserted I used this simple rule:

Find: <a href="http://www.photodropper.com/photos/" target="_blank">photo</a>
Replace: empty string

To remove the link and image that the Inbound Writer Plugin inserts, I used this regular expression rule:

Find: /<a href="http:\/\/getinboundwriter\.com\/wordpress\/"><img src="http:\/\/infolific\.com\/wp-content\/plugins\/inboundwriter\/images\/iw_purple\.png" alt="Optimized with InboundWriter"class="alignleft" style="border:0;clear:both;"\/><\/a>/
Replace: empty string

2. Add a Nofollow Attribute

When I think a widget plugin author has been fair with their insertion of a link, I'll keep it, but I may want to make it a nofollow link. For example, here's a rule to change an external link to nofollow:

Find: rel="nofollow" href="http://www.ignitesocialmedia.com/tools/follow-me/"
Replace: rel="nofollow" rel="nofollow" href="http://www.ignitesocialmedia.com/tools/follow-me/"

3. Remove Tags From the Head Section

WordPress inserts some tags into the head section of the HTML that result in undesirable pagination. While there are other plugins that can remove these, since I'm already using the Real-Time Find and Replace plugin, I can use it to remove these tags like so:

Find: /<link rel="next"(.*)?\/>/
Replace: empty string

Find: /<link rel="prev"(.*)?\/>/
Replace: empty string

4. Change the Location of Scripts

A lot of plugins make use of jquery scripts and they often include these from a local directory. You can reduce server load and improve page load times by requesting these scripts from a CDN. For example, the WP Social Lock plugin calls the prototype.js script locally, but it's also available from Google's CDN. Using the following rule allowed me to load the script from Google without having to modify the WP Social Lock plugin:

Find: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js
Replace: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js

5. Remove Unneeded Scripts

Sometimes plugins insert scripts that you don't actually need because you haven't enabled some functionality. In such cases these scripts are just slowing page load times. To remove one such script which was inserted by the Digg Digg plugin, I used the following regular expression rule:

Find: /<script(.*)?sharethis\.com\/button\/buttons\.js(.*)?<\/script>/
Replace: empty string

6. Change a Script to Async

By adding the async attribute to JavaScript includes you can decrease the apparent page load time. To change existing includes to async, I used this rule:

Find: <script type='text/javascript' src=
Replace: <script async type='text/javascript' src=

Note: Not everything works correctly when changed to async so be sure to test.

7. Change Social Media Meta Tags

While arguably not something that is going to improve your rankings, the following tweaks to social media tags are something I take on when doing SEO. What I find is that often Twitter and OpenGraph tags are being generated with the site's name injected into them which I think looks messy when the post is shared on Twitter or Facebook. I've used this rule to tidy these tags:

Find: | Infolific'/>
Replace: '/>

I've also seen OpenGraph description tags used on category pages that were too long because the category page had a long introduction. To remedy this issue I used a regular expression rule to truncate long descriptions to 250 characters like so:

Find: /<meta property="og:description" content="([^"]{250})([^"]*)" \/>/
Replace: <meta property="og:description" content="\1" />

If this plugin sounds like it must be useful, you can buy it here.

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.67 out of 5)
Loading...

2 Comments

  1. I do local marketing. If I wanted to take a generic article (without the viewers city) on it and someone in the city of Dallas asked for wedding florist could I add where yey were to the text? Maybe be listed in their SERP results and on the page they read titled as wedding florist in Dallas? I guess it comes down to finding their location down to general city area. Then having the plugin insert the city name... Then if someone in San Antonio requested the same article it would change the text to S.A. Hmmmm

    • The plugin looks for a snippet of text/code and replaces that snippet with something. So you have to be able to write a rule to find something and then specify what to replace it with. It sounds like you may not know what to replace it with when you write the rule.

Leave a Reply

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

Notify me of followup comments via e-mail.