Plugin of the Week: Search and Replace

We ran across an interesting problem when we transferred a WordPress site from Dreamhost to Bluehost. We actually did a database export/import with phpMyAdmin instead of using the XML export tool built into WordPress.

When the database was transferred over to the new site, something had converted or rendered the apostrophe characters (‘) in the site to a weird character string: â€™

So we had this seemingly weird string appearing on different posts and pages.

So how could you fix this? One way would be to give the aptly named “Search and Replace” plugin a whirl. It worked really well for our site considering it replaced over 400 character errors – which would have taken a really long time to fix manually.

Once the Search and Replace plugin is installed and activated, you’ll find it under the Tools menu. Select the database field where you want to perform the search and replace. Most of the time this would be “content.” Make sure to scroll to the bottom of the page to use the search + replace function.

Search replace plugin

Make sure you have a backup of your the original MySQL file just in case you need to restore it because there isn’t an undo function. Again, there is no undo so be careful using this plugin.

Here are five other common conversion errors that we also had to fix.

• = bullet point •

— = long dash/hyphen —

“ = start quote “

” = end quote ”

’ = apostrophe '

Get it: “Search and Replace” plugin

Side note: If you’re an advanced user and want to prevent this error from happening, here’s a solution at the MySQL level.

Improve search results for your visitors

We have reviewed WordPress plugins that help return better search results for your WordPress site like the Relevanssi plugin. But how about helping your users fix their spelling in the search box before they hit “submit” – like Google or major search engines do?

We just noticed this relatively new plugin called “Proper Spell.” We haven’t tried it yet but it’s supposed to auto suggest the correct spelling while the user is typing in something into your search box. It requires a bit of intermediate knowledge as you’ll need to plugin a code

Get it: Proper Spell

Quick Tip: Add excerpts to search results page

If you’ve tried searching for a keyword on a WP site, you may have noticed that the search results don’t always include an excerpt of matching page(s). While you’re at it, have you tried the search function on your site? The missing excerpt is not WordPress’s fault, in reality the theme designer neglected or chose not to include that feature in the theme.

Here’s how to quickly add an excerpt to your search results page by hacking your theme. Important: make sure you have a copy of your original theme and/or backup the existing search.php page ready to restore in case you get in trouble. We’re not responsible if you muck up your site.

In WordPress admin, select Appearance -> Editor -> Search.php (screenshot below) Add the following tag after the end of the headline tag, usually </h2>:

<?php the_excerpt(); ?>

And hit “Save” and go try a search on your site!

the_excerpt_wordpress_code.jpg

Another tip, now that you’ve improved it with excerpts,  why not improve it further by trying Relevanssi plugin? Relevannsi will help bump up the quality of matching results. You’ll still need to  do a bit of work tagging your posts or pages but it’s worth it.

Quick Tip: Tag pages to get better search results page

You know that search field on your WordPress site? Have you ever tried looking for certain keywords or phrases that your readers might try typing in? Chances are that quite a few common keywords aren’t showing the most relevant posts or pages that you want them to do. Sure, you can easily add tags to posts. But how about pages? Unfortunately, WordPress doesn’t currently allow tags on pages, but you can use a simple plugin called “Page Tagger” to add tags to important pages. It adds a sidebar widget on the pages editor just like posts.

You can team up Page Tagger plugin with a tool like Relevanssi to fine tune your search results so you give your audience what they’re looking for!

Get it: Page Tagger