Search code examples
phpwordpressmigrationbroken-linkswordpress-admin

Wordpress why i'm Not getting folder name on site url after site migration


I have migrated our WordPress website from the live to the local environment by using the updraft plus plugin.

After migration, I have edited the home & siteurl to http://localhost/sitename instead of the domain URL in the wp_options table. Also, I have re-saved the changes in the General and Permalink setting under wp-admin.

The wp-admin works properly and also the site working properly, but I am facing the issue of a broken link.

All the URLs which are started with "/wp-content/themes/....." are not able to take the whole localhost site URL (i.e. localhost/sitename), It is taken as "localhost/wp-content/themes/...." only.

This means the site name is missing on each and every URL, that's why I am not able to load styles and bootstrap links that are on the website.

Please suggest.


Solution

  • This is a good example of using a wordpress function called site_url() instead of using localhost/sitename when you develop your app!

    You could read more about it on the documentation page:

    WordPress site_url() function

    The main benefit of using this function is, you will have to update your production url just once, in one place which is the admin menu and it'll get updated every where throughout your site where you've called site_url() on your links.