mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
In category dropdown, 'selected' should match against 'value_field'.
Props tlexcellent. Fixes #32330. git-svn-id: https://develop.svn.wordpress.org/trunk@32484 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user