| @@ -120,9 +120,9 @@ | ||
| 120 | 120 | * |
| 121 | 121 | * @return $this |
| 122 | 122 | */ |
| 123 | 123 | public function where_not_ids( $ids ) { |
| 124 | - $this->args['post__not_in'] = (array) $ids; | |
| 124 | + $this->args['post__not_in'] = (array) $ids; // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in -- Intentional exclusion, dataset is controlled and limited | |
| 125 | 125 | |
| 126 | 126 | return $this; |
| 127 | 127 | } |
| 128 | 128 | |
| @@ -192,9 +192,9 @@ | ||
| 192 | 192 | * @return $this |
| 193 | 193 | */ |
| 194 | 194 | public function orderBy( $field, $direction = 'ASC' ) { |
| 195 | 195 | $this->args['orderby'] = 'meta_value'; |
| 196 | - $this->args['meta_key'] = $field; | |
| 196 | + $this->args['meta_key'] = $field; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Required for ordering by custom field | |
| 197 | 197 | $this->args['order'] = $direction; |
| 198 | 198 | |
| 199 | 199 | return $this; |
| 200 | 200 | } |
| @@ -207,12 +207,13 @@ | ||
| 207 | 207 | public function get() { |
| 208 | 208 | $this->args['numberposts'] = - 1; |
| 209 | 209 | |
| 210 | 210 | if ( $meta = $this->build_meta_query() ) { |
| 211 | - $this->args['meta_query'] = $meta; | |
| 211 | + $this->args['meta_query'] = $meta; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Meta query is necessary for filtering posts by custom fields | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if ( $this->tax_query ) { |
| 215 | + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- Required for filtering posts by taxonomy | |
| 215 | 216 | $this->args['tax_query'] = count( $this->tax_query ) > 1 |
| 216 | 217 | ? array_merge( array( 'relation' => 'AND' ), $this->tax_query ) |
| 217 | 218 | : $this->tax_query; |
| 218 | 219 | } |
| @@ -238,12 +239,13 @@ | ||
| 238 | 239 | $this->args['posts_per_page'] = $per_page; |
| 239 | 240 | $this->args['paged'] = $page; |
| 240 | 241 | |
| 241 | 242 | if ( $meta = $this->build_meta_query() ) { |
| 242 | - $this->args['meta_query'] = $meta; | |
| 243 | + $this->args['meta_query'] = $meta; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Meta query is necessary for filtering posts by custom fields | |
| 243 | 244 | } |
| 244 | 245 | |
| 245 | 246 | if ( $this->tax_query ) { |
| 247 | + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- Required for filtering posts by taxonomy | |
| 246 | 248 | $this->args['tax_query'] = count( $this->tax_query ) > 1 |
| 247 | 249 | ? array_merge( array( 'relation' => 'AND' ), $this->tax_query ) |
| 248 | 250 | : $this->tax_query; |
| 249 | 251 | } |
| @@ -271,13 +273,13 @@ | ||
| 271 | 273 | public function first() { |
| 272 | 274 | $this->args['numberposts'] = 1; |
| 273 | 275 | |
| 274 | 276 | if ( $meta = $this->build_meta_query() ) { |
| 275 | - $this->args['meta_query'] = $meta; | |
| 277 | + $this->args['meta_query'] = $meta; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Meta query is necessary for filtering posts by custom fields | |
| 276 | 278 | } |
| 277 | 279 | |
| 278 | 280 | if ( $this->tax_query ) { |
| 279 | - $this->args['tax_query'] = $this->tax_query; | |
| 281 | + $this->args['tax_query'] = $this->tax_query; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- Required for filtering posts by taxonomy | |
| 280 | 282 | } |
| 281 | 283 | |
| 282 | 284 | $posts = get_posts( $this->args ); |
| 283 | 285 | |
| @@ -293,13 +295,13 @@ | ||
| 293 | 295 | $this->args['posts_per_page'] = 1; |
| 294 | 296 | $this->args['fields'] = 'ids'; |
| 295 | 297 | |
| 296 | 298 | if ( $meta = $this->build_meta_query() ) { |
| 297 | - $this->args['meta_query'] = $meta; | |
| 299 | + $this->args['meta_query'] = $meta; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Meta query is necessary for filtering posts by custom fields | |
| 298 | 300 | } |
| 299 | 301 | |
| 300 | 302 | if ( $this->tax_query ) { |
| 301 | - $this->args['tax_query'] = $this->tax_query; | |
| 303 | + $this->args['tax_query'] = $this->tax_query; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- Required for filtering posts by taxonomy | |
| 302 | 304 | } |
| 303 | 305 | |
| 304 | 306 | $query = new WP_Query( $this->args ); |
| 305 | 307 | |