Hook ‘wpseo_exclude_from_sitemap_by_term_ids’ is ineffective
-
Hi there,
I am running a website with TotalContest, Yoast, the W3TC caching plugin and CloudFlare.
For the purpose of this support thread, I am clearing the entire cache and disabling W3TC as well as purging CloudFlare and pausing caching. I can verify caching is disabled.
TotalContest creates posts (‘contest_submission’) that can be categorized. I have 3 categories: ‘ese2024’, ‘parichka2023’ and ‘parichka2024’ and I want to exclude all posts inside ‘ese2024’ from the sitemap and indexing. All the posts are publicly published and therefore indexed in the sitemap.
To exclude ‘ese2024’ from the indexing, I opened phpMyAdmin and found the following in the ‘wp_terms’ table:term_id name slug term_group 66 ese2024 ese2024
And to exclude the posts related, I used the following hook:
/** * Excludes terms with ID of 66 from terms sitemaps. * * @param array $terms Array of term IDs already excluded. * * @return array The terms to exclude. */ function sitemap_exclude_terms( $terms ) { return [ 66 ]; } add_filter( 'wpseo_exclude_from_sitemap_by_term_ids', 'sitemap_exclude_terms', 10, 1 );
With all this said and done, I am still getting the posts from this category indexed in the sitemap.
The page I need help with: [log in to see the link]
- The topic ‘Hook ‘wpseo_exclude_from_sitemap_by_term_ids’ is ineffective’ is closed to new replies.