简体   繁体   English

沙盒Wordpress链接到实时网站

[英]Sandbox Wordpress linked to Live Site

I'm working on a Wordpress site that needs a major overhaul... Made a separate domain for a testing environment. 我正在一个需要进行大修的Wordpress网站上……为测试环境创建了一个单独的域。 Changed all settings I can think of, edited the database when I exported, defined the new url and home in the wp-config file... 更改了我能想到的所有设置,导出时编辑了数据库,在wp-config文件中定义了新的url和home ...

Yet somehow i'm getting linked to the old site. 但是我却以某种方式链接到旧站点。 In other words, i'm on newsite.com but it's really pulling from oldsite.com. 换句话说,我在newsite.com上,但实际上是从oldsite.com提取的。

So newsite.com/wp-admin is really oldsite.com/wp-admin ... Any changes I make are reflected on the old site, not the new. 因此newsite.com/wp-admin确实是oldsite.com/wp-admin ...我所做的任何更改都反映在旧网站上,而不是新网站上。

I'm pretty stumped here. 我在这里很困惑。

Make sure that you define both WP_HOME and WP_SITEURL in wp-config.php: 确保在wp-config.php中同时定义WP_HOME和WP_SITEURL:

define('WP_HOME','http://newsite.com');
define('WP_SITEURL','http://newsite.com');

Then add update the siteurl and home options by adding this to the functions.php file in your theme: 然后通过将其添加到主题中的functions.php文件中来更新siteurl和home选项:

update_option('siteurl','http://newsite.com');
update_option('home','http://newsite.com');

You can set the WP_HOME and WP_SITE settings dynamically to match the current domain: 您可以动态设置WP_HOME和WP_SITE设置以匹配当前域:

In your wp-config.php change the lines to read: 在您的wp-config.php中,将行更改为:

define('WP_HOME','http://' . $_SERVER['SERVER_NAME']);
define('WP_SITEURL','http://' . $_SERVER['SERVER_NAME']);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM