The assets [javascripts,css and other files] are loading from the old server. I need to point them all to the new server url.How to do it? enter image description here

They have to be replaced with the new domain url.

1 Answer 1


Usually scripts and styles are loaded with wp_enqueue_script or wp_enqueue_style in the theme's functions.php. That's the most common scenario.

This function takes an $src parameter which is the absolute URL to the resource, and the best practice is to use get_stylesheet_directory_uri to retrieve the URL to the folder containing the script. This way, if the site is moved, the URL will change with it.

It might be that those were hardcoded strings. That's why they're still the old ones.

See examples below https://developer.wordpress.org/reference/functions/wp_enqueue_script/#user-contributed-notes

Scripts and styles loaded from a plugin should use plugins_url in the $src parameter. wp_enqueue_style( 'prm_style', plugins_url('/assets/style.css', __FILE__ ) );

  • Thanks a lot ! The below is how my function.php looks: <?php if ( !function_exists( 'bezel_parent_css' ) ){ function bezel_parent_css() { wp_enqueue_style( 'bezel-parent-style', trailingslashit( get_template_directory_uri() ) . 'style.css', array( 'bundle-css' ) ); wp_dequeue_style( 'style'); wp_enqueue_style( 'style'); } } add_action( 'wp_enqueue_scripts', 'bezel_parent_css', 14 ); function evereteam_enqueue_script() { wp_enqueue_script( 'everteam-script', '/script.js', false ); } add_action( 'wp_enqueue_scripts', 'evereteam_enqueue_script' ); Oct 1, 2020 at 7:39
  • Can you please let me know how to fix this Thanks a lot! Oct 1, 2020 at 7:40
  • Then how to fix these hardcoded strings and replace them with the new server url Oct 1, 2020 at 7:43
  • Ah sorry, looks like those highlighted URLS are loaded from a plugin "prm_addon". Can you look in that plugin's code? The scripts woulld also be loaded with wp_enqueue_script but use plugins_url in the $src parameter
    – Paul
    Oct 1, 2020 at 7:47
  • Not only "prm_addon" plugin Many plugins scripts are loading the same Oct 1, 2020 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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