WordPress.org

Make WordPress Core

Ticket #30306: 30306.patch

File 30306.patch, 948 bytes (added by collinsinternet, 7 years ago)

value_field argument

  • wp-includes/category-template.php

     
    10971097
    10981098                /** This filter is documented in wp-includes/category-template.php */
    10991099                $cat_name = apply_filters( 'list_cats', $category->name, $category );
    1100 
    1101                 $output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\"";
     1100                /** If the value_field argument is set and if it is part of the $category object, then sent it as the option value.* */
     1101                if ( isset( $args[ 'value_field' ] ) && isset( $category->$args[ 'value_field' ] ) ) {
     1102                        $output .= "\t<option class=\"level-$depth\" value=\"" . $category->$args[ 'value_field' ] . "\"";
     1103                } else {
     1104                        $output .= "\t<option class=\"level-$depth\" value=\"" . $category->term_id . "\"";
     1105                }
    11021106                if ( $category->term_id == $args['selected'] )
    11031107                        $output .= ' selected="selected"';
    11041108                $output .= '>';