
/**
 * ============================================================
 * Hide Categories From Homepage
 * ============================================================
 */

function bt_hide_categories_from_homepage($query) {

    if (is_admin()) {
        return;
    }

    if (!$query->is_main_query()) {
        return;
    }

    if (!(is_home() || is_front_page())) {
        return;
    }

    // 要隐藏的 Category Slug
    $slugs = array(
        'betting',
        'slot-game',
        'general-news',
    );

    $exclude_ids = array();

    foreach ($slugs as $slug) {

        $category = get_category_by_slug($slug);

        if ($category) {

            $exclude_ids[] = $category->term_id;

            // 连子分类一起隐藏
            $children = get_term_children($category->term_id, 'category');

            if (!is_wp_error($children)) {
                $exclude_ids = array_merge($exclude_ids, $children);
            }
        }
    }

    if (!empty($exclude_ids)) {
        $query->set('category__not_in', $exclude_ids);
    }

}

add_action('pre_get_posts', 'bt_hide_categories_from_homepage');<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//globalstraits.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>http://globalstraits.com/post-sitemap.xml</loc>
		<lastmod>2026-08-17T08:11:01+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>http://globalstraits.com/page-sitemap.xml</loc>
		<lastmod>2026-07-30T07:53:50+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>http://globalstraits.com/category-sitemap.xml</loc>
		<lastmod>2026-08-17T08:11:01+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>http://globalstraits.com/author-sitemap.xml</loc>
		<lastmod>2026-06-22T09:43:24+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->