Broken CSS after changing the site URL

If you have access to your mysql you can update the wp-options table.

Before modification…

$ mysql -u <db_user> --password=<db_pwd> -D <db_name> <<<"select * from wp_options where option_name in ('siteurl', 'home');"
+-----------+-----------------+---------------------------------------------------------------------------------------------------+----------+
| option_id | option_name     | option_value                                                                                      | autoload |
+-----------+-----------------+---------------------------------------------------------------------------------------------------+----------+
|         1 | siteurl         | http://172.17.0.2/wordpress                                                                       | yes      |
|         2 | home            | http://172.17.0.2/wordpress                                                                       | yes      |
+-----------+-----------------+---------------------------------------------------------------------------------------------------+----------+

Then I changed the ip to 172.17.0.4 with this…

$ mysql mysql -u <db_user> --password=<db_pwd> -D <db_name> <<<"update wp_options set option_value="http://172.17.0.4/wordpress" where option_name in ('siteurl', 'home');"    

So the table becomes…

+-----------+-----------------+---------------------------------------------------------------------------------------------------+----------+
| option_id | option_name     | option_value                                                                                      | autoload |
+-----------+-----------------+---------------------------------------------------------------------------------------------------+----------+
|         1 | siteurl         | http://172.17.0.4/wordpress                                                                       | yes      |
|         2 | home            | http://172.17.0.4/wordpress                                                                       | yes      |
+-----------+-----------------+---------------------------------------------------------------------------------------------------+----------+

In some scenarios it could be useful to automatically update this configuration.

Leave a Comment