WordPress.org

Make WordPress Core

Ticket #16190: default-category.patch

File default-category.patch, 705 bytes (added by johnjamesjacoby, 2 years ago)

Set default category on post list

  • includes/class-wp-posts-list-table.php

     
    212212                        if ( is_object_in_taxonomy( $post_type, 'category' ) ) { 
    213213                                $dropdown_options = array( 
    214214                                        'show_option_all' => __( 'View all categories' ), 
    215                                         'hide_empty' => 0, 
    216                                         'hierarchical' => 1, 
    217                                         'show_count' => 0, 
    218                                         'orderby' => 'name', 
    219                                         'selected' => $cat 
     215                                        'hide_empty'      => 0, 
     216                                        'hierarchical'    => 1, 
     217                                        'show_count'      => 0, 
     218                                        'orderby'         => 'name', 
     219                                        'selected'        => (int) $cat 
    220220                                ); 
    221221                                wp_dropdown_categories( $dropdown_options ); 
    222222                        }