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 (5 votes, average: 4.80 out of 5)
Loading...

20 Comments

  1. Hi, how do I make this plugin work with the LiteSpeed WordPress cache plugin?

    • Flush the cache after you set up the replacements. The replacements will then be applied to the pages and then re-cached with the replacements.

      • Noted but weirdly the plugin changes are only showing when I am signed into the WordPress dashboard. I am using the free version of the plugin. The website is built using Elementor and Hello Elementor.

        • When you're logged in, you're probably seeing uncached, up-to-date pages. When you're logged out, the cached version is shown. My caching plugin works that way so I'm guessing yours does too.

          Try adding a parameter to the page's URL as that sometimes forces the cache to update e.g. /page/?param=something

        • @Marios the last issue is without the caching plugin. I have disabled it.

        • It still sounds like a caching issue. Perhaps there's caching even without the plugin e.g. if the cache exists on third-party servers like CloudFlare and takes time to expire.

  2. Hello. I want to ask if we can use the plugins for onsite seo as in replacing simple text words with a link.
    and a second Q, does this affect speed in any way? If yes how many replacements and over would you say in giving a difference/slowdown in speed?

    cheers

    • If you see the test when using your browser's "view source" feature then you can replace it. As for speed, I haven't noticed any impact, but I also haven't formally measured.

  3. Hello, I bought the professional version of this plug-in about two years ago, and the plug-in version I currently install is 4.0.3
    What is the latest version of this professional plug-in? How can I get updates?

    • When an update is available, there will be an update link in WordPress' plugin administration page.

  4. One of my pages just had a number updated. Is it possible to use this plugin to do a find/replace on the number itself?

    • Yes.

  5. Marios, Can I replace any text in the Admin Area or plugin what works on the back-end with the paid version of Real-Time Find and Replace Plugin?

    I could not find any information about the paid version.

    Thanks in advance
    Celso Jr

    • There is a checkbox that allows changes to be applied to admin pages. You have to be careful with this feature though because if you replace something critical to the display of the admin pages such that you can't update/disable rules, you'll need to deactivate the plugin somehow to return things to normal.

  6. I tried to find and replace shortcodes on my site but no plugin couldn't do it. Will this plugin be able to hide the old shortcode and show the new one?

    • No this plugin will execute after shortcodes so it won't "see" the shortcode.

  7. Works on localhost /xamp/
    But brakes website design on live host.

    Is this plugin needs special PHP version?

    • The plugin doesn't have special PHP requirements. Problems are usually due to the rules matching too broadly resulting in invalid HTML.

  8. 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.