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

Suppress filters in get_posts false positive

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

@tomjn がすでに取り組んでいます。

2026年10月1日 から。

  • #900 @tomjn による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php, wordpress
領域
tooling

調査の方向性

Reproduce the warning using the minimal get_posts() snippet against the VIP Coding Standards main branch, then trace how the phpcs:ignore comment is handled alongside suppress_filters. Done means the false-positive warning is no longer reported while the intended meta_key warning remains available.

索引モデルが issue の本文から書いたものです。

説明

Bug Description

This get_posts call generates a warning that you must use suppress_filters set to false for performance reasons, despite that already being the case:

	$post_ids = get_posts( [
		'post_type'        => [ 'post' ],
		'post_status'      => 'publish',
		'fields'           => 'ids',
		'meta_key'         => 'foobar', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
		'suppress_filters' => false,
	] );

My suspicion is that phpcs ignore comment is breaking the parsing of the array somehow.

( Note this is legacy code, we're aware of the meta_key issue )

Minimal Code Snippet

	$post_ids = get_posts( [
		'post_type'        => [ 'post' ],
		'post_status'      => 'publish',
		'fields'           => 'ids',
		'meta_key'         => 'foobar', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
		'suppress_filters' => false,
	] );

Error Code

⚠️ Warning( severity 3 ): get_posts() is uncached unless the "suppress_filters" parameter is set to false. If the suppress_filter parameter is set to false this can be safely ignored. More Info: https://docs.wpvip.com/technical-references/caching/uncached-functions/ (WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts).

Environment

This occurred 1st October in the VIP Coding standards bot on a github pull request

Tested Against main branch?

  • I have verified the issue still exists in the main branch of VIPCS.
  • I have verified the issue still exists in the develop branch of VIPCS.
主要言語
PHP
スター
261
フォーク
44
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

Automattic/VIP-Coding-Standards のほかの issue

Automattic/VIP-Coding-Standards の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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