css - get_template_directory_uri() generates wrong path

I've uploaded a wordpress site but it's missing javascript and css. The links on the head still have the local

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'] );

and

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

but they didn't help...

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'] );

and

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

but they didn't help...

Share Improve this question edited Oct 28, 2019 at 12:59 kero 6,3401 gold badge25 silver badges34 bronze badges asked Oct 28, 2019 at 12:33 Emmanuel RichmanEmmanuel Richman 134 bronze badges 4
  • 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 Commented Oct 28, 2019 at 12:59
  • Have you updated the all of your site links after the migration? Please show us your enqueue code – Arsalan Mithani Commented Oct 28, 2019 at 13:11
  • Have you set the correct URL in Settings > General? – Jacob Peattie Commented Oct 29, 2019 at 5:40
  • I have the same problem. In a development environment I want to use settings different from those in wp_options table. In the back end I do see the grayed out versions of site_url and home conforming the setting in wp_config.php. However, get_template_directory_uri() just returns the one in wp_settings, not the one in wp_config.php. – th00ht Commented Apr 14, 2020 at 9:32
Add a comment  | 

1 Answer 1

Reset to default 1

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','http://www.new-site') WHERE option_name = 'home' OR option_name = 'siteurl';

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

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

# Change meta data url
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.old-site','http://www.new-site');

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745048220a4608225.html

相关推荐

  • css - get_template_directory_uri() generates wrong path

    I've uploaded a wordpress site but it's missing javascript and css. The links on the head still have the local

    7小时前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信