No Description
Wordpress always use an absolute url, so when you import an image or file the src tag is populate like so: src="http://localhost/..".
This approch is fine if you work only in local or in production but in the real life get some issues.
For a small project is simple check each page and correct the src tag manually. But when you have a project with 20/30 pages or more this come a nightmare!
For this reason I wrote this simple customizable query to replace all src tags on each pages.
@search and/or @replace valuesBy default this query replace http://localhost/ with /.
# Provide a string being searched for
SET @search = 'http://localhost/';
# Provide a string that replaces found search values
SET @replace = '/';
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`, @search, @replace) WHERE `post_type` LIKE 'page' AND `post_content` REGEXP @replace;