mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
First pass at giving taxonomies a show_ui param. See #10773
git-svn-id: https://develop.svn.wordpress.org/trunk@13216 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -20,7 +20,10 @@ function create_initial_taxonomies() {
|
||||
'label' => __('Categories'),
|
||||
'singular_label' => __('Category'),
|
||||
'query_var' => false,
|
||||
'rewrite' => false
|
||||
'rewrite' => false,
|
||||
'public' => true,
|
||||
'show_ui' => true,
|
||||
'_builtin' => true
|
||||
) ) ;
|
||||
|
||||
register_taxonomy( 'post_tag', 'post', array(
|
||||
@@ -29,13 +32,19 @@ function create_initial_taxonomies() {
|
||||
'label' => __('Post Tags'),
|
||||
'singular_label' => __('Post Tag'),
|
||||
'query_var' => false,
|
||||
'rewrite' => false
|
||||
'rewrite' => false,
|
||||
'public' => true,
|
||||
'show_ui' => true,
|
||||
'_builtin' => true
|
||||
) ) ;
|
||||
|
||||
register_taxonomy( 'link_category', 'link', array( 'hierarchical' => false,
|
||||
'label' => __('Categories'),
|
||||
'query_var' => false,
|
||||
'rewrite' => false
|
||||
'rewrite' => false,
|
||||
'public' => false,
|
||||
'show_ui' => false,
|
||||
'_builtin' => true,
|
||||
) ) ;
|
||||
}
|
||||
add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
|
||||
@@ -189,7 +198,14 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||
if ( ! is_array($wp_taxonomies) )
|
||||
$wp_taxonomies = array();
|
||||
|
||||
$defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true);
|
||||
$defaults = array( 'hierarchical' => false,
|
||||
'update_count_callback' => '',
|
||||
'rewrite' => true,
|
||||
'query_var' => $taxonomy,
|
||||
'public' => true,
|
||||
'show_ui' => null,
|
||||
'_builtin' => false
|
||||
);
|
||||
$args = wp_parse_args($args, $defaults);
|
||||
|
||||
if ( false !== $args['query_var'] && !empty($wp) ) {
|
||||
@@ -210,6 +226,9 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||
$wp_rewrite->add_permastruct($taxonomy, "/{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
|
||||
}
|
||||
|
||||
if ( is_null($args['show_ui']) )
|
||||
$args['show_ui'] = $args['public'];
|
||||
|
||||
foreach ( array('manage_cap', 'edit_cap', 'delete_cap') as $cap ) {
|
||||
if ( empty($args[$cap]) )
|
||||
$args[$cap] = 'manage_categories';
|
||||
|
||||
Reference in New Issue
Block a user