Using WordPress plugin –
Search And Replace
This is simple WordPress plugin, Does database query to replace any content. This plugin can be used to replace a string ( say – localhost:8888 ) with a new one ( domain.com ) .
Direct updating MySQL Database –
Or, If you’ve access to MySQL Server you can simply replace the old domain with new one using this SQL Query
UPDATE wp_posts SET post_content = REPLACE ( post_content, 'http://universitycompare.com:8888/imagepathurl/etc', 'http://universitycompare.com/imagepathurl/etc' );
( Note – Above code is not tested, Backup your database before using it )
Using WordPress Filter –
Here’s simple filter to used in
functions.php
, Simply replaces the old domain name with new oneadd_filter( 'the_content', 'wpse64204_img' ); function wpse64204_img( $content ) { $old_url="/universitycompare.com:8888/"; $new_url="universitycompare.com"; $new_content = preg_replace($old_url, $new_url, $content); return $new_content; }
( Note – This does not updated the Database )