diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
index 7c3f8e1a12..b91d9d9e45 100644
|
a
|
b
|
class WP_Query {
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
| | 397 | * Helper to check current query type against provided condition. |
| | 398 | * |
| | 399 | * Centralizes logic shared by is_*() conditional methods to reduce |
| | 400 | * duplication and ease maintenance. |
| | 401 | * |
| | 402 | * @since 7.0.0 |
| | 403 | * |
| | 404 | * @param string $type Conditional type (e.g., 'is_home', 'is_single'). |
| | 405 | * @return bool True if current query matches the given type. |
| | 406 | */ |
| | 407 | protected function is_query_type( $type ) { |
| | 408 | return ! empty( $this->$type ) && true === $this->$type; |
| | 409 | } |
| | 410 | |
| | 411 | /** |
| 397 | 412 | * Is the query for the blog homepage? |
| 398 | 413 | * |
| 399 | 414 | * @since 1.5.0 |
| … |
… |
class WP_Query {
|
| 401 | 415 | * @return bool |
| 402 | 416 | */ |
| 403 | 417 | public function is_home() { |
| 404 | | return (bool) $this->is_home; |
| | 418 | return $this->is_query_type( 'is_home' ); |
| 405 | 419 | } |
| 406 | 420 | |
| 407 | 421 | /** |
| … |
… |
class WP_Query {
|
| 409 | 423 | * @return bool |
| 410 | 424 | */ |
| 411 | 425 | public function is_single() { |
| 412 | | return (bool) $this->is_single; |
| | 426 | return $this->is_query_type( 'is_single' ); |
| 413 | 427 | } |
| 414 | 428 | |
| 415 | 429 | /** |
| … |
… |
class WP_Query {
|
| 417 | 431 | * @return bool |
| 418 | 432 | */ |
| 419 | 433 | public function is_page() { |
| 420 | | return (bool) $this->is_page; |
| | 434 | return $this->is_query_type( 'is_page' ); |
| 421 | 435 | } |