How to search for and replace escaped paths in a WordPress database

I recently migrated a website to the host WP Engine. Before the migration the site had WordPress installed in it’s own directory. The directory, in this case, was named wp.

WP Engine doesn’t allow this kind of directory setup, so I had to move all the WordPress files up to the root and then remove wp from all paths in WordPress’s MySQL database.

I used the PHP WordPress Search and Replace Tool to edit a copy of the database that I had imported to WP Engine.

Initially I did a search for the string and replaced all matches with


This worked for everything except some escaped paths I found in the table created by the Slider Revolution plugin. The paths in this table looked like this:



To fix these escaped paths I had to search for the string\\\/wp and replace all matches with

2 thoughts on “How to search for and replace escaped paths in a WordPress database

  1. Tommy Detamore

    Ben you are a lifesaver! I was pulling my hair out trying to figure out why my Revolution Slider photos were not showing up on my live site. I was getting close in that I knew the paths in the database for the photos were still pointing to my local development site (ie, localhost:8888), and I was trying to use searchreplacedb2.php to correct the paths. But for the life of me I could not get the syntax correct that would result in a successful replace. Your tip made it all work! Thanks so much!

    1. Ben Pearson Post author

      You’re welcome Tommy. I’m glad I could save you some time and frustration mate. Thanks for the feedback.


Leave a Reply

Your email address will not be published. Required fields are marked *