In category dropdown, 'selected' should match against 'value_field'.

Props tlexcellent.
Fixes #32330.
Built from https://develop.svn.wordpress.org/trunk@32484


git-svn-id: http://core.svn.wordpress.org/trunk@32454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-05-11 13:11:31 +00:00
parent 987716720f
commit 7314a0f3df
2 changed files with 7 additions and 5 deletions

View File

@ -1165,13 +1165,15 @@ class Walker_CategoryDropdown extends Walker {
/** This filter is documented in wp-includes/category-template.php */
$cat_name = apply_filters( 'list_cats', $category->name, $category );
if ( ! isset( $args['value_field'] ) || ! isset( $category->{$args['value_field']} ) ) {
$args['value_field'] = 'term_id';
if ( isset( $args['value_field'] ) && isset( $category->{$args['value_field']} ) ) {
$value_field = $args['value_field'];
} else {
$value_field = 'term_id';
}
$output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $category->{$args['value_field']} ) . "\"";
$output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $category->{$value_field} ) . "\"";
if ( $category->term_id == $args['selected'] )
if ( $category->{$value_field} == $args['selected'] )
$output .= ' selected="selected"';
$output .= '>';
$output .= $pad.$cat_name;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32483';
$wp_version = '4.3-alpha-32484';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.