您需要使用manage_posts_extra_tablenav
过滤器,但您可以使用wp_dropdown_categories()
作用
唯一的两个$args
你真正感兴趣的是depth
和taxonomy
, 但我已经包括了下面所有的默认值。
完整的详细信息wp_dropdown_categories()
function can be found in the Codex
add_filter(\'manage_posts_extra_tablenav\', \'my_add_category_dropdown\');
function my_add_category_dropdown(){
$args = array(
\'show_option_all\' => \'\',
\'show_option_none\' => \'\',
\'option_none_value\' => \'-1\',
\'orderby\' => \'ID\',
\'order\' => \'ASC\',
\'show_count\' => 0,
\'hide_empty\' => 1,
\'child_of\' => 0,
\'exclude\' => \'\',
\'echo\' => 1,
\'selected\' => 0,
\'hierarchical\' => 0,
\'name\' => \'cat\',
\'id\' => \'\',
\'class\' => \'postform\',
\'depth\' => 0,
\'tab_index\' => 0,
\'taxonomy\' => \'category\',
\'hide_if_empty\' => false,
\'value_field\' => \'term_id\',
);
wp_dropdown_categories($args);
}