WordPress.org

Support

Support » How-To and Troubleshooting » Site-wide string search/replace

Site-wide string search/replace

  • HeroOfSpielburg
    Member

    @heroofspielburg

    Hello,

    I’m new to the database paradigm for blogging, so please excuse the ignorance of my question.

    Does anyone know a way to do a site-wide search and replace for a string? For example, go through all posts, find “http://mysite.com/blah” and change to “/bleh”.

    Thanks for the help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Why not just export out the database, run a search and replace using a text editor like Ultraedit, and reimport it?

    HeroOfSpielburg
    Member

    @heroofspielburg

    I suppose that may be what I’ll have to do. I’ve never opened up a SQL db before, and I was a little leery of doing so and then reintegrating it to WordPress.

    I was hoping there was already some kind of WP-side interface for something like this, but I guess I have to jump and make it happen.

    Thanks.

    Les Bessant
    Participant

    @lesbessant

    There is a Search and Replace Plugin, which does direct database updates.

    I’ve used it a couple of times, and it does what it says it will. As with anything that can make major changes, make sure you have a backup of your database first.

    I have the same issue and S and R pluging does not do it for me. For one thing it is all in German. I tried just doing a search without replace and didn’t get any hits.

    I am moving my images to a Gallery 2 system and need to change the photo links in the posts.

    Any other suggestions?

    Pizdin Dim
    Member

    @pizdin_dim

    This SQL update query will work, assuming your table is called “wp_posts”, the old string is “http://mysite.com/blah” and the new string is “/bleh”:

    update wp_posts set post_content = replace(post_content, 'http://mysite.com/blah', '/bleh');

    You will need the MySQL client tool or something like phpmyadmin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Site-wide string search/replace’ is closed to new replies.