Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Documentation: The "Exclude a taxonomy term from sitemap" code doesn't do anything

オープン
#340 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
wordpress
領域
documentation

調査の方向性

docs/features/xml-sitemaps/api.md から始め、報告された挙動に照らして、記載されている wpseo_exclude_from_sitemap_by_term_ids の例を確認してください。issue で挙げられている関連フィルター(wpseo_sitemap_entry を含む)を調査し、その後、タクソノミー用語を除外するために記載されている方法が正確でテスト可能になるよう、ガイダンスを更新または削除してください。

索引モデルが 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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Yoast/developer のほかの issue

Yoast/developer の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。