Opened 8 years ago
Last modified 2 months ago
#41471 new enhancement
Page dropdown walker must check selected against value field
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Posts, Post Types | Keywords: | has-patch needs-unit-tests needs-testing |
| Focuses: | Cc: |
Description
Walker_PageDropdown only checks selected with the page ID and ignores value_field option.
Attachments (1)
Change History (6)
#1
@
7 years ago
- Component changed from General to Posts, Post Types
- Keywords has-patch needs-unit-tests added
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
2 months ago
This ticket was mentioned in PR #10203 on WordPress/wordpress-develop by @SirLouen.
2 months ago
#4
Refreshing 41471.diff for Testing and Review Purposes
Trac ticket: https://core.trac.wordpress.org/ticket/41471
#5
@
2 months ago
- Focuses administration removed
- Keywords needs-testing added
- Type changed from defect (bug) to enhancement
- Version 4.9 deleted
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.
Related: #43522