// 1、彻底屏蔽古腾堡全部谷歌字体
function xintheme_remove_gutenberg_styles($translation, $text, $context, $domain)
{
    // 匹配所有谷歌字体上下文，统一返回off，屏蔽全部字体
    if ($context === 'Google Font Name and Variants') {
        return 'off';
    }
    return $translation;
}
add_filter('gettext_with_context', 'xintheme_remove_gutenberg_styles', 10, 4);

// 定义返回true工具函数，解决未定义报错
function _return_true() {
    return true;
}

// 2、全局禁用所有自动更新（内核/插件/主题）
add_filter('automatic_updater_disabled', '_return_true');
add_filter('auto_update_core', '_return_true');
add_filter('auto_update_plugin', '_return_true');
add_filter('auto_update_theme', '_return_true');

// 3、移除更新定时任务与后台检测钩子
add_action('init', function () {
    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');
});

// 拦截WP官方更新API请求，减少外网卡顿
add_filter('http_request_args', function($args, $url) {
    $block_urls = [
        'api.wordpress.org',
        'downloads.wordpress.org'
    ];
    foreach ($block_urls as $block) {
        if (str_contains($url, $block)) {
            $args['timeout'] = 0.01;
        }
    }
    return $args;
}, 10, 2);<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://xczyw.xcziyuanwu.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://xczyw.xcziyuanwu.com/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://xczyw.xcziyuanwu.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://xczyw.xcziyuanwu.com/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://xczyw.xcziyuanwu.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
