[wp-trac] [WordPress Trac] #40650: get_pages() should accept 'any' among it's post_status arg
WordPress Trac
noreply at wordpress.org
Tue Mar 3 12:19:16 UTC 2026
#40650: get_pages() should accept 'any' among it's post_status arg
--------------------------------------+------------------------------
Reporter: pbiron | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 4.7.4
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Changes (by ozgursar):
* keywords: has-patch has-unit-tests needs-testing => has-patch has-unit-
tests
Comment:
== Patch Testing Report
Patch Tested: https://github.com/WordPress/wordpress-develop/pull/8042
=== Environment
- WordPress: 7.0-beta2-61752-src
- PHP: 8.2.29
- Server: nginx/1.29.4
- Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
- Browser: Chrome 145.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.4
- MU Plugins: None activated
- Plugins:
* Test Reports 1.2.1
=== Steps taken
1. Using WordPress Develop environment run the wp cli command below.
Change the container name `wordpress-develop-cli-1` if necessary.
{{{
docker exec wordpress-develop-cli-1 wp eval 'print_r( get_pages( [
"post_status" => "any" ] ) );' --allow-root
}}}
2. Confirm that no output is printed
3. Apply the patch and run the same command
4. Confirm that `get_pages()` returns a `WP_Post Object`
5. ✅ Patch is solving the problem
=== Expected result
- Calling `get_pages( [ 'post_status' => 'any' ] )` should return pages of
all statuses (publish, draft, private, etc.), consistent with how
`WP_Query` handles the `'any'` keyword. After applying the patch from PR
8042, the function returns a populated array of `WP_Post` objects spanning
all post statuses, confirming the patch is solving the problem.
=== Screenshots/Screencast with results
Before
[[Image(https://i.imgur.com/531lBfm.png)]]
After
[[Image(https://i.imgur.com/LDtppmv.png)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40650#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list