Commit acb4554
committed
Query: Set
The static front page backstop in `WP_Query::get_posts()` sets `is_page = true` and `is_home = false`, but did not update `is_singular`. This caused the query to generate incorrect SQL — using `post_type = 'post'` instead of `post_type = 'page'` — and return zero results.
The equivalent check in `parse_query()` correctly maintains the invariant by recalculating `is_singular` at line 1135. The `get_posts()` backstop now does the same.
The backstop fires when `parse_query()` fails to detect the static front page because `$this->query` contains unexpected public query vars (anything not in the allowlist of `preview`, `page`, `paged`, `cpage`). This can happen when a plugin registers a query var that collides with a parameter WordPress core uses in preview URLs.
Fixes #65072.is_singular in the get_posts() static front page backstop.1 parent 8e3998b commit acb4554
File tree
2 files changed
+43
-0
lines changed- src/wp-includes
- tests/phpunit/tests/query
2 files changed
+43
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2041 | 2041 | | |
2042 | 2042 | | |
2043 | 2043 | | |
| 2044 | + | |
2044 | 2045 | | |
2045 | 2046 | | |
2046 | 2047 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
75 | 117 | | |
76 | 118 | | |
77 | 119 | | |
| |||
0 commit comments