If set show_ui
false
, this hide the taxonomy meta box and admin menu link both, how to hide only meta box?
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => false,
'show_admin_column' => false,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'wheel' ),
);
register_taxonomy( 'wheel', array( 'product' ), $args );
If set show_ui
false
, this hide the taxonomy meta box and admin menu link both, how to hide only meta box?
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => false,
'show_admin_column' => false,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'wheel' ),
);
register_taxonomy( 'wheel', array( 'product' ), $args );
Share
Improve this question
asked Jun 30, 2016 at 19:09
SeviSevi
3152 gold badges4 silver badges8 bronze badges
3 Answers
Reset to default 7You're looking for the meta_box_cb
argument.
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => false,
'show_admin_column' => false,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'wheel' ),
'meta_box_cb' => false,
);
register_taxonomy( 'wheel', array( 'product' ), $args );
You can also define a custom callback function for displaying your own metabox if you'd like. Refer to the documentation for register_taxonomy().
i registered the taxonomy without showing any of the UI element
add_action( 'init', 'kia_register_featured_tax', 0 );
function kia_register_featured_tax(){
if(!taxonomy_exists('portfolio_featured')){
$labels = array(
'name' => _x( 'Featured', $this->plugin_domain ),
'singular_name' => _x( 'Featured', $this->plugin_domain )
);
$args = array(
'labels' => $labels,
'rewrite' => array( 'slug' => 'portfolio-featured' ),
'query_var' => true,
'public' => true,
'show_ui' => false,
'show_tagcloud' => false,
'show_in_nav_menus' => false,
);
register_taxonomy( 'portfolio_featured', array( 'portfolio' ), $args );
}
}
To clarify the answer from @NateWr, you need to set show_ui
to true
, set show_in_menu
to true
and set meta_box_cb
to false
:
$args = array(
'show_ui' => true,
'show_in_menu' => true,
'meta_box_cb' => false,
//Plus anything else you need...
);
register_taxonomy( 'wheel', array( 'product' ), $args );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745603402a4635534.html
评论列表(0条)