最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

urls - Changing siteurl in the database not working

programmeradmin0浏览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?

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?

Share Improve this question asked Jan 23, 2022 at 16:52 bobbob 132 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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
发布评论

评论列表(0)

  1. 暂无评论