Creating “static” taxonomies to choose from, inside custom post type?

  1. Make it show_ui => false

    Then to show it on the post edit screen add the box manually

    add_action('add_meta_boxes', 'meta_boxes_function');
    
    function meta_boxes_function() {
         add_meta_box('categoriesdiv', 'categories', 'post_categories_meta_box', 'blurb', 'side', null, array('taxonomy' => 'categories'));
    }
    
  2. use this code for every static term

    if(!term_exists('term1', 'categories'))
        wp_insert_term('term1', 'categories');
    

Leave a Comment