I've uploaded a wordpress site but it's missing javascript and css. The links on the head still have the local path (src='https://localhost...') and not the new ones. So I guess it has to do with get_template_direcory_uri() that I use in fucntions.php to apply my javascript/jquery,bootstrap,css etc.

How yo fix that?

I've tried adding to config.php:

define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
define( 'WP_HOME',    'http://' . $_SERVER['HTTP_HOST'] );


define( 'WP_HOME', 'https://...' );
define( 'WP_SITEURL', 'https://...' );

but they didn't help...

  • Can you show how you enqueue your styles and scripts? Please make sure to use formatting, you can see how to do it from my edit – kero Oct 28 '19 at 12:59
  • Have you updated the all of your site links after the migration? Please show us your enqueue code – Arsalan Mithani Oct 28 '19 at 13:11
  • Have you set the correct URL in Settings > General? – Jacob Peattie Oct 29 '19 at 5:40

Do your URL change up in phpMyAdmin with SQL language:

# Change website url
UPDATE wp_options
SET option_value = replace(option_value, 'http://www.old-site.com','http://www.new-site.com') WHERE option_name = 'home' OR option_name = 'siteurl';

# Change GUID URL
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.old-site.com','http://www.new-site.com');

# Change url of medias, post, page, etc.
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.old-site.com','http://www.new-site.com');

# Change meta data url
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.old-site.com','http://www.new-site.com');
  • Thanks for your help. – Emmanuel Richman Oct 29 '19 at 8:08
  • Beware that this can break your site even further. WordPress stores some data serialized (especially in the postmeta and options table). Running these queries will destroy the serialized strings. Instead, you can use the WP-CLI (especially with the --precise flag) or plugins such as Better Search Replace. – kero Oct 29 '19 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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