Documentation: The "Exclude a taxonomy term from sitemap" code doesn't do anything
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 35/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- wordpress
调研方向
从 docs/features/xml-sitemaps/api.md 开始,根据报告的行为检查文档中 wpseo_exclude_from_sitemap_by_term_ids 的示例。调查 issue 中提到的相关过滤器,包括 wpseo_sitemap_entry,然后更新或删除相关说明,确保文档中排除 taxonomy term 的方式准确且可测试。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- JavaScript
- 星标
- 15
- 派生
- 23
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Yoast/developer 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 78/100
-
难度 5/5 一周以上 新手友好度 25/100
-
Typos 未关闭
难度 2/5 1-3 小时 新手友好度 48/100
-
bug
难度 3/5 1-2 天 新手友好度 55/100
-
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
mksglu/context-mode#1200 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
neondatabase/website#5944 ·
-
module: core
难度 2/5 1-3 小时 新手友好度 75/100
bigbluebutton/bigbluebutton#25849 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
jaegertracing/jaeger-ui#4506 ·