How to Remove Unwanted Text in Migrated Posts

Ever feel like you want to use white-out on your blog for content you need to remove or replace? If you move from Blogger to WordPress, your posts are sure to contain text that you no longer want. For example I had a post template that added this to the end of  new posts:

Notice the spider logo has a bad image address (it’s no longer hosted where I had my html website ). I wanted to stop using the spider anyway. Also the signature logo has the wrong background color for this template and I no longer use it on recent posts.

My current post ‘footer’ is a simple call to sign-up by email.  So I scratched my head until a resourceful teammate found this plugin for one of our clients. The client’s blog had a funny rss-atom link that was used in the Blogger feed but appeared at the bottom of every imported post. Apparently Blogger screens out the line when displaying the posts.

To the rescue: The Search and Replace Plugin

WordPress.org Plugin Page » Search & Replace Description: by Mark Cunningham

A simple search for find strings in your database and replace the string. You can search in ID, post-content, GUID, title, excerpt, meta-data, comments, comment-author, comment-e-mail, comment-url, tags/categories and categories-description.

Step-by-step

  1. Add and Activate the Search and Replace plugin. Find the plugin options under Tools on the dashboard. You’ll notice and need to respect this warning:
  2. Attention: You cannot undo any changes made by this plugin.It is therefore advisable to backup your database before running this plugin. No legal claims to the author of this plugin! Activate the plugin only, if you want to use it! Text search is case sensitive and has no pattern matching capabilites. This replace function matches raw text so it can be used to replace HTML tags too.
  3. For images, get the current html that you want to replace and do just a search for the string before any replacements. Find a post and view the html mode for exact string! In my case the html for the signature was:
    <a href=”http://l.b5z.net/i/u/6049594/i/blog/relatedspider.gif”><img style=”float: left; height: 50px; margin: 0px 10px 10px 0px; width: 60px;”src=”http://l.b5z.net/i/u/6049594/i/blog/relatedspider.gif” border=”0″ alt=”spider logo” /></a>
  4. Place your string in search-only box,  check the ‘field’ box press Go button The Search found 6 posts with that image string. (Write down the names of the posts just in case!)
  5. So let’s replace it for real. Rather than substitute a different image, I want to replace the spider logo with a line break: <br/> Be sure to first select where to search/replace — I checked off  ‘content’. Paste the string, this time in the real search spot.  Place the new string (in my case a line break) code in the” replace” field.  Close your eyes and press “Go.”
  6. Here’s what one post looked like after replacement of spider logo only:

    No logo, aligns left
  7. I then did the same for the signature html, replacing it with a blank line.

Tips and Strange Happenings

The results seem to include revision copies of the posts you want to change.  And in one case I was editing one of the posts while the plugin was running so it created an autosave which I had to publish to see the removed text! So don’t have any posts in edit mode at the time. Also the search only results had various post ids different from the published posts.

I discovered the actual html in terms of upper/lowercase varied so that my search missed some posts where the html had “Float:” instead of “float:” or placed the ‘height=’ in a different spot within the tag. So I had to find the variations and redo. It helped to search for ‘spider logo’ then see the posts listed and spot the variations. Perhaps depends on whether post was published in Blogger or WP and how WP felt that day — who doesn’t want a little variety? … lol

You might ask was this worth it for 6 or 9 posts? Well, yes since the posts may be sprinkled in your archives and who wants to go hunting for them? If nothing else the search-only will give you a results list to go in and manually replace.

Bottom line, it works. Just be sure to backup your database. Happy erasing!

Let me know what you use it for — leave a comment.

Get BPWebNews delivered by email


If you found this post useful, leave a comment and share your thoughts with others.
Get future posts in your RSS feed or by email.


7 Comments

  1. Very valuable and practical information for people who are blogging for themsleves or a website promoting a product or whatever. Very well thought out – I will make my bloggers read it!

Comments are closed.