Documentation: The "Exclude a taxonomy term from sitemap" code doesn't do anything
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- wordpress
- Domain
- documentation
Research direction
Start with docs/features/xml-sitemaps/api.md and review the documented wpseo_exclude_from_sitemap_by_term_ids example against the reported behavior. Investigate the related filters named in the issue, including wpseo_sitemap_entry, then update or remove the guidance so the documented way to exclude taxonomy terms is accurate and testable.
Written by the indexing model from the issue text.
Description
Please give us a description of the issue
On https://github.com/Yoast/developer/blob/main/docs/features/xml-sitemaps/api.md you give a function for removing taxonomy terms from site maps.
I've aadded the following code to my theme functions.php:
function sitemap_exclude_terms( $terms ) {
return [208];
}
add_filter( 'wpseo_exclude_from_sitemap_by_term_ids', 'sitemap_exclude_terms' );
Posts in category ID 208 are still appearing on my post-sitemap.xml. I know it's not a caching issue because I subsequently added a test post and it appeared in the sitemap immediately. I have tested this with numerous different categories and with including single or multiple IDs in the array.
The code should probably either be corrected or removed.
- [X ] I've read and understood the contribution guidelines.
- [X ] I've searched for any related issues and avoided creating a duplicate issue.
UPDATE: The only way I was able to actually successfully filter the sitemap was using the wpseo_sitemap_entry filter. Filters I tried that didn't seem to ever run: wpseo_exclude_from_sitemap_by_term_ids, wpseo_sitemap_exclude_post, and a query with wpseo_sitemap_posts_query. Some sort of clearer documentation might have saved me some time.
- Dominant language
- JavaScript
- Stars
- 15
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Yoast/developer
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Typos Open
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/safe-publish#594 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
dream-num/dsh-univer-office#104 ·
-
comp/dashboard invalid P3
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
NousResearch/hermes-agent#121143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
avniproject/avni-webapp#1811 ·
-
area/auroraboot area/webui bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100