WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have moved a theme from local to live and the image URL's are showing my live localhost default url instead of the current live url.

Any idea's on why and how to fix this?

The site is live at universitycompare.com, then jump to university guide and you will see my problem - incase you wanted something live to look at it.

The images are being located as a default URL under http://universitycompare.com:8888/imagepathurl/etc

Just want to revert all the media back to the original which should be: http://universitycompare.com/imagepathurl/etc

share|improve this question
up vote 1 down vote accepted

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

( 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 one

add_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 )

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.