Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I just created a custom post type and a custom taxonomy:

// === CUSTOM TAXONOMIES === //
add_action('init', 'my_custom_taxonomies', 0);

function my_custom_taxonomies() {
    register_taxonomy(
        'location',     // internal name = machine-readable taxonomy name
        'static_content',       // object type = post, page, link, or custom post-type
        array(
            'hierarchical' => true,
            'labels' => array(
                'name' => __( 'Location' ),
                'singular_name' => __( 'Location' ),
                'add_new_item' => 'Add New Location',
                'edit_item' => 'Edit Location',
                'new_item' => 'New Location',
                'search_items' => 'Search Location',
                'not_found' => 'No Location found',
                'not_found_in_trash' => 'No Location found in trash',
            ),
            'query_var' => true,    // enable taxonomy-specific querying
            'rewrite' => array( 'slug' => 'location' ), // pretty permalinks for your taxonomy?
        )
    );

    wp_insert_term('Footer', 'location');
    wp_insert_term('Header', 'location');
}


// === CUSTOM POST TYPES === //
add_action( 'init', 'create_my_post_types' );

function create_my_post_types() {
    register_post_type( 'static_content',
        array(
            'labels' => array(
                'name' => __( 'Static Content' ),
                'singular_name' => __( 'Static Content' ),
                'add_new_item' => 'Add New Static Content',
                'edit_item' => 'Edit Static Content',
                'new_item' => 'New Static Content',
                'search_items' => 'Search Static Content',
                'not_found' => 'No Static Content found',
                'not_found_in_trash' => 'No Static Content found in trash',
            ),
            '_builtin' => false,
            'public' => true,
            'hierarchical' => false,
            'taxonomies' => array( 'location'),
            'supports' => array(
                'title',
                'editor',
                'excerpt'
            ),
            'rewrite' => array( 'slug' => 'static_content', 'with_front' => false )
        )
    );
}

But when I enter the edit page of my custom post type, on the sidebar it says "All Categories." It should say "All Locations."

How do I change that label?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Add this to the labels array:

'all_items' => __( 'All Locations' ),

See register_taxonomy() docs for full description of labels argument.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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