You have a lot of blog posts on your wordpress self hosted blog where you refer to a particular URL. Now somehow that URL got changed and you need to edit your posts. To change all those URL’s, one way is to go one by one, open and edit MySQL Replaceall your posts. Not a smart way.

Other way would be to use MySQL and batch edit them at a click of a button. No need to be a techie, anyone can do this.

This was useful for me when recently I made a move from blogger to wordpress. There were about 25 posts where I needed to change a particular URL. Here is how I did and you can do this in under 5 minutes.

  1. Log on to PHPMyadmin. [Your webhost should have provided the URL to access it.] 
  2. Select your database name from the drop down given on the left hand side.
  3. In SQL tab type
    UPDATE wp_posts SET post_content = replace(post_content, 'OLD CONTENT’, 'NEW CONTENT'); 

    and hit GO.

The above SQL statement replaces all the occurrences of OLD_CONTENT with NEW_CONTENT inside the content(post_content) of all posts(wp_posts). Make sure that wp_posts is indeed the name of your posts table. On shared hosting the name of this table is different sometimes.

For techies: Here is the syntax of MySql Replace function REPLACE(str,from_str,to_str)

Pin It on Pinterest

Share This