Opened 9 years ago
Last modified 12 months ago
#41471 new enhancement
Page dropdown walker must check selected against value field
| Reported by: | geminorum | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Posts, Post Types | Version: | |
| Severity: | normal | Keywords: | has-patch needs-unit-tests needs-testing |
| Cc: | Focuses: |
Description
Walker_PageDropdown only checks selected with the page ID and ignores value_field option.
Attachments (1)
Change History (6)
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
12 months ago
This ticket was mentioned in PR #10203 on WordPress/wordpress-develop by @SirLouen.
12 months ago
#4
Refreshing 41471.diff for Testing and Review Purposes
Trac ticket: https://core.trac.wordpress.org/ticket/41471
#5
@
12 months ago
- Focuses administration removed
- Keywords needs-testing added
- Type defect (bug) → enhancement
- Version 4.9
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
- Create a new page with the slug
test-slug-page - Create two or three other pages for the example
- Add the shortcode to a plugin or wherever it can be executed
- Add the shortcode to anotherpage
- The page with the
test-slug-pageslug should be selected by default
Actual Results
- ✅ Issue resolved with patch.
Additional Notes
- Given that we are already setting by default the ID to $argsvalue_field, having the option of assigning whatever
value_fieldwe prefer, as provided in the example in supp artifacts, improves this. - This must be upgraded to
enhancementas this is not a bug per se. - Some unit test coverage for this would be ideal.
Supplemental Artifacts
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' );
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Related: #43522