WordPress优化 网站搭建后访问速度非常慢,后台首页加载ajax.googleapis.com解决办法
https://www.microeco.net/2929.html

关闭更新

define('AUTOMATIC_UPDATER_DISABLED', true );

网站名更换

UPDATE wp_options SET option_value = REPLACE(option_value, 'http://www.lf.1959.ink', 'http://dev.lf.1959.ink') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.lf.1959.ink', 'http://dev.lf.1959.ink');

UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.lf.1959.ink','http://dev.lf.1959.ink');

UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'http://www.lf.1959.ink', 'http://dev.lf.1959.ink');

UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'http://www.lf.1959.ink','http://dev.lf.1959.ink');

UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.lf.1959.ink', 'http://dev.lf.1959.ink') WHERE post_type = 'attachment';

sql 语句一键生成
https://tool.wpjam.com/change-domain/

functions.php 加上

 
// 彻底关闭自动更新
add_filter('automatic_updater_disabled', '__return_true');
// 关闭更新检查定时作业
remove_action('init', 'wp_schedule_update_checks');
// 移除已有的版本检查定时作业
wp_clear_scheduled_hook('wp_version_check');
// 移除已有的插件更新定时作业
wp_clear_scheduled_hook('wp_update_plugins');
// 移除已有的主题更新定时作业 
wp_clear_scheduled_hook('wp_update_themes');
// 移除已有的自动更新定时作业 
wp_clear_scheduled_hook('wp_maybe_auto_update');
// 移除后台内核更新检查 
remove_action( 'admin_init', '_maybe_update_core' );
// 移除后台插件更新检查 
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'load-update-core.php', 'wp_update_plugins' );
remove_action( 'admin_init', '_maybe_update_plugins' );
 // 移除后台主题更新检查 
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'load-update-core.php', 'wp_update_themes' );
remove_action( 'admin_init', '_maybe_update_themes' );

//禁PHP版本检测
function prefix_remove_site_health( $tests ) {
unset( $tests['direct']['php_version'] );
return $tests;
}
add_filter( 'site_status_tests', 'prefix_remove_site_health' );

//彻底的禁止XML-RPC的功能
add_filter( 'xmlrpc_enabled', '__return_false' );
// 去除加载谷歌字体
function coolwp_remove_open_sans_from_wp_core() {
        wp_deregister_style( 'open-sans' );
        wp_register_style( 'open-sans', false );
        wp_enqueue_style('open-sans','');
    }
    add_action( 'init', 'coolwp_remove_open_sans_from_wp_core' );

//
Last modification:April 2nd, 2020 at 01:20 am