0

I'm trying to change siteurl and home in the database, but whenever I try to change after 5 seconds they automatically change back to the previous url.

Is it related to the server?

1 Answer 1

0

WordPress has a number of standard methods to change or override these url options:

  • using update_option() function in functions.php or anywhere else in the code, this way: update_option( 'siteurl', 'https://yourdomain.com' );
    update_option( 'home', 'https://yourdomain.com' );
    This is most likely your case because update_option() edits db entries at runtime.
    In this case, just remove or comment out these lines where you find them.
  • using define();
    define( 'WP_HOME', 'https://yourdomain.com' );
    define( 'WP_SITEURL', 'https://yourdomain.com' );
    This only overrides the setting but does not change the entries in the database.

If your url changes in the address bar, but does not change in the database, this may happen due to WordPress caching. Try one of these:

  • edit wp-config.php and add define('ENABLE_CACHE', FALSE);
  • add a query string with an argument to clear cache, i.e. https://yourdomain.com/?x=z
  • if you use CloudFlare or other caching service, clear cache for this url

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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