• Hi,

    We’re trying to use your plugin to add a custom taxonomy to our users. But after adding the taxonomy and assigning users to the taxonomy terms, the count always shows 0…

    What could be the problem?

    Taxonomy code:

    register_taxonomy('profession', 'user', array(
        'public'        =>true,
        'single_value' => false,
        'show_admin_column' => true,
        'labels'        =>array(
            'name'                      =>'Professions',
            'singular_name'             =>'Specialisme',
            'menu_name'                 =>'Specialismes',
            'search_items'              =>'Search Professions',
            'popular_items'             =>'Popular Professions',
            'all_items'                 =>'All Professions',
            'edit_item'                 =>'Edit Profession',
            'update_item'               =>'Update Profession',
            'add_new_item'              =>'Add New Profession',
            'new_item_name'             =>'New Profession Name',
            'separate_items_with_commas'=>'Separate professions with commas',
            'add_or_remove_items'       =>'Add or remove professions',
            'choose_from_most_used'     =>'Choose from the most popular professions',
        ),
        'rewrite'       =>array(
            'with_front'                =>true,
            'slug'                      =>'author/profession',
        ),
        'capabilities'  => array(
            'manage_terms'              =>'edit_users',
            'edit_terms'                =>'edit_users',
            'delete_terms'              =>'edit_users',
            'assign_terms'              =>'read',
        ),
    ));

    When using the below code or viewing the taxonomy in the admin dashboard, it always shows 0 under count…

    $terms = get_terms(array(
      'taxonomy' => 'profession',
      'hide_empty' => false
    ));
    foreach ($terms as $terms) {
       echo $terms->name . ": ";
       echo $terms->count. "<br>"; 
    }
    • This topic was modified 2 years, 11 months ago by wiwi293.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Taxonomy shows 0 users per term’ is closed to new replies.