[wp-trac] [WordPress Trac] #41471: Page dropdown walker must check selected against value field
WordPress Trac
noreply at wordpress.org
Thu Oct 9 14:36:25 UTC 2025
#41471: Page dropdown walker must check selected against value field
-------------------------------------------------+-------------------------
Reporter: geminorum | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future
| Release
Component: Posts, Post Types | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests needs- | Focuses:
testing |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-patch needs-unit-tests => has-patch needs-unit-tests
needs-testing
* focuses: administration =>
* type: defect (bug) => enhancement
* version: 4.9 =>
Comment:
== Reproduction and Patch Testing Report
=== Description
✅ This report validates that the indicated issue can be reproduced and
patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/10203
=== Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.29
- Server: nginx/1.29.1
- Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
- Browser: Chrome 140.0.0.0
- OS: Windows 10/11
- Theme: Twenty Seventeen 3.9
- MU Plugins: None activated
- Plugins:
* BBB Testing Dolly
* Classic Editor 1.6.7
* Test Reports 1.2.0
=== Testing Instructions
1. Create a new page with the slug `test-slug-page`
2. Create two or three other pages for the example
3. Add the shortcode to a plugin or wherever it can be executed
4. Add the shortcode to anotherpage
5. The page with the `test-slug-page` slug should be selected by default
=== Actual Results
1. ✅ Issue resolved with patch.
=== Additional Notes
- Given that we are already setting by default the ID to
$args['value_field'], having the option of assigning whatever
`value_field` we prefer, as provided in the example in supp artifacts,
improves this.
- This must be upgraded to `enhancement` as this is not a bug per se.
- Some unit test coverage for this would be ideal.
=== Supplemental Artifacts
{{{#!php
function test_page_dropdown() {
get_pages();
$dropdown = wp_dropdown_pages( array(
'echo' => 0,
'value_field' => 'post_name',
'selected' => 'test-slug-page',
'name' => 'test_dropdown',
'show_option_none' => 'Select a page',
) );
echo $dropdown;
}
add_shortcode( 'test_dropdown', 'test_page_dropdown' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41471#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list