2

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 );
3

You'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().

0

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 );
    }
}
0

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 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.