I have written a custom taxonomy for my custom post type to use. The custom post type works perfectly fine, and the taxonomy displays where I want it and how I want it.

However, despite hours of searching and changing, I can’t get my taxonomy to work properly. Adding or deleting tags requires me to manually refresh before anything happens – “Quick edit”, however, works fine.

Clicking “Add new” does nothing. Clicking “Delete” produces An unidentified error has occurred. as error.

Can somebody point me in the right direction as to what’s wrong and why it isn’t working?


The custom post type code:

//Register Post Type and settings
 add_action('init', 'register_pf_type');
 function register_pf_type(){
    $labels = array(
        'name'              => __('MMD Portfolios', 'secondtest'), 
        'singular_name'     => __('MMD Portfolio', 'secondtest'), 
        'add_new'           => __('Add New', 'secondtest'), 
        'add_new_item'      => __('New MMD Portfolio', 'secondtest'), 
        'new_item'          => __('New MMD Portfolio', 'secondtest'),
        'edit_item'         => __('Edit MMD Portfolio', 'secondtest'),
        'view_item'         => __('View MMD Portfolio', 'secondtest'),
        'all_items'         => __('All MMD Portfolios', 'secondtest'),
        'search_items'      => __('Search Portfolios', 'secondtest'),
        'not_found'         => __('No Portfolios found.', 'secondtest'),
        'not_found_in_trash'=> __('No Portfolios found in trash.', 'secondtest')
    $args = array(
        'labels'            => $labels,
        'public'            => false, 
        'publicly_queryable'=> false,
        'show_ui'           => true, 
        'show_in_admin_bar' => false, 
        'taxonomies'        => array('divisions'),
        'menu_position'     => 25, 
        'capability_type'   => 'post', 
        'has_archive'       => false,
        'hierarchical'      => false,
        'supports'          => array( 'title' ),
        'menu_icon'         => 'dashicons-sos' //Pre-existing dashicons save a lot of trouble
    register_post_type('mmd_pf', $args);

And the custom taxonomy code:

    add_action('init', 'create_mmd_taxonomy',0);
    function create_mmd_taxonomy(){
    $labels = array(
        'name' => _x('Divisions', 'taxonomy general name', 'secondtest'),
        'singular_name' => _x('Division', 'taxonomy singular name', 'secondtest'),
        'popular_items' => __('Popular Divisions', 'secondtest'),
        'all_items' => __('All Divisions', 'secondtest'),
        'parent_item' => null,
        'parent_item_colon' => null,
        'edit_item' => __('Edit Division', 'secondtest'), 
        'search_items' => __('Search Divisions','secondtest'),
        'update_item' => __('Update Division', 'secondtest'),
        'add_new_item' => __('Add New Division', 'secondtest'),
        'new_item_name' => __('New Division Name', 'secondtest'),
        'separate_items_with_commas' => __('Separate divisions with commas', 'secondtest'),
        'add_or_remove_items' => __('Add or remove divisions', 'secondtest'),
        'choose_from_most_used' => __('Choose from the most used divisions', 'secondtest'),
        'menu_name' => __('Divisions', 'secondtest'),

    $args= array(
        'hierarchical' => false,
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'update_count_callback' => '_update_post_term_count',
        'rewrite' => array( 'slug' => 'divisions' ),
    register_taxonomy('divisions', 'mmd_pf', $args);

Again, if I manually refresh after clicking delete or add new, everything works. I’ve looked everywhere but cannot find the bug.

Read more here: Custom Taxonomies "Add new" or "delete" do not work


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: