WordPress更换网站域名

Q:Wordpress网站换域名后,进不了后台怎么办?

A:打开wp-config.php文件,
define(‘WP_DEBUG’, false);
下面加新域名:

define(‘WP_HOME’,’https://www.onexin.net’);
define(‘WP_SITEURL’,’https://www.onexin.net’);

Q:网站内容中的旧网址怎么更换?

A:执行一条SQL语句:
UPDATE `wp_posts` SET `post_content` = replace (`post_content`,'http://old.com','https://www.onexin.net');
或者编写PHP文件,访问一次:

<?php
include_once __DIR__ . '/wp-load.php';
$wpdb->query("UPDATE `wp_posts` SET `content` = replace (`content`,'http://old.com','https://www.onexin.net');");
exit;

转载请注明出处:https://www.onexin.net/wordpress-change-domain/

相关文章:

1、如何发布插件或模板到 WordPress 官方网站
https://www.onexin.net/add-your-plugin-to-wordpress/

2、WordPress中mo和po文件编辑与转换
https://www.onexin.net/wordpress-mo-and-po-file-editing-and-conversion/

3、Wordpress自带Widget在模板中调用最新评论
https://www.onexin.net/wordpress-widget-comes-with-the-latest-comments-in-the-template-call/

4、Gravatar头像打开速度很慢,解决办法
https://www.onexin.net/gravatar-picture-is-slow-to-open-the-solution/

5、TinyMCE Syntaxhighlighter Plugin for Wordpress
https://www.onexin.net/tinymce-syntaxhighlighter-plugin-for-wordpress/

Leave a Reply