| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 56 | private static function handle_maybe_custom_posts_page( $query ) { |
||
| 57 | if ( $custom_posts_page = get_option( 'page_for_posts' ) ) { |
||
| 58 | if ( |
||
| 59 | isset( $query->query['p'] ) && |
||
| 60 | absint( $query->query['p'] ) === absint( $custom_posts_page ) |
||
| 61 | ) { |
||
| 62 | return new \WP_Query( array( 'post_type' => 'post' ) ); |
||
| 63 | } |
||
| 64 | } |
||
| 65 | |||
| 66 | return $query; |
||
| 67 | } |
||
| 68 | } |
||
| 69 |
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state