wordpress theme link url

There’s possible a couple different things going on, so here’s a relatively generic answer.

Site URL

Many URLs are influenced by the Site URL settings in Settings > General. The steps for properly moving a site are too long for a single answer, but review the “Changing the Site URL” codex page and make sure you’ve covered all the steps.

WordPress API URL Functions

For things like stylesheets and scripts, you should be using wp_enqueue_style() and wp_enqueue_script() to load them. However, you still need to know the locations of files. That’s where get_template_directory_uri(), get_stylesheet_directory_uri(), plugins_url(), and other similar functions come in. They’ll return the correct URLs based on the Site settings (above) so that when you move the site, the srcs for all resources are updated.

An example:

add_action( 'wp_enqueue_scripts', 'wpse183676_enqueuer' );
function wpse183676_enqueuer() {
    wp_enqueue_script( 'my-script', get_template_directory_uri() . '/js/myscript.js' );
}

Bundled Scripts

Finally, go one step further, there are many scripts that come with WordPress so you don’t need to provide your own copy or even know where the specific files are. Just use the correct handle for any of the scripts bundled with WordPress and they’ll automatically load.

In the simplest form, that would look like this:

add_action( 'wp_enqueue_scripts', 'wpse183676_enqueuer' );
function wpse183676_enqueuer() {
    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'my-script', get_template_directory_uri() . '/js/myscript.js' );
}

However, we can accomplish the same results even faster by using the $dependencies argument of wp_enqueue_script() like this:

add_action( 'wp_enqueue_scripts', 'wpse183676_enqueuer' );
function wpse183676_enqueuer() {
    wp_enqueue_script( 'my-script', get_template_directory_uri() . '/js/myscript.js', array( 'jquery' ) );
}

tech