In the settings, I changed the site address, but the new one, the database, works. But styles are not loaded, but chrome logs, localhost's address as root, although plug-in style files are loaded using the get_template_directory_uri () function. I can not understand what needs to be changed?

  • File wp-config.php rule? - Andrew Hobbit
  • In the database there are links to the old address, you need to specify a new one. - Valery Emelyanov
  • You need to look at the parameters in the wp-config.php and the first two entries in the wp_options database table - alenkins

1 answer 1

WordPress stores all links in the database as absolute. If your current domain is called example.com, then all internal links look like this: http://example.com/wp-content/uploads/2016/10/foo.jpg

For the site to work properly on a new domain (say, test.ru), all links in the database should be changed to the following: http://test.ru/wp-content/uploads/2016/10/foo.jpg

In order to bulk replace links in the database, you can use the Search and Replace Database . If the site stays in place, then that's enough.

To transfer the site to another server, it is more convenient to use the Duplicator plugin.

  • one
    I’ll also add a search-replace command from the console wp-cli: wp-cli.org/commands/search-replace Transfer it with its help. - artoodetoo
  • you open the database you are looking for examle.com select Ctrl + H quick replacement and change to test.com and everything is ready and nothing is needed, and you do not need plug-ins, you can do everything with pens, if they are overgrown from the right place - Lieutenant Jim Dangle
  • @LieutenantJimDangle this procedure is possible only if the base has already been imported to the local computer. And most importantly, it does not work at all if the links are in the serialized data of themes, plug-ins, sliders, etc. 100% guaranteed to ditch the base. So with pens you can fix the database of only the most primitive WordPress sites. For all others, the above plug-ins work correctly with serialized data. - KAGG Design
  • @KAGGDesign are you kidding? if the site is not on the portal and some bases are connected through migration, then what method will you do, and what does it mean to destroy the base? if you transfer to another domain, then you need to change all urls to anybody and just by selecting exactly foo.com you can easily replace it with bar.com - Lieutenant Jim Dangle
  • @LieutenantJimDangle here is an example of a serialized string describing the product WooCommerce (removed the unimportant in dots ...) (107, 'a: 5: {... s: 48: " elitechs.ru/… "; ...), replacing elitechs .ru here on test.ru ruins the base. It is clear why? - KAGG Design