Ich habe gerade einen benutzerdefinierten Posttyp und eine benutzerdefinierte Taxonomie erstellt:
// === 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 ) ) ); }
Aber wenn ich die Bearbeitungsseite meines benutzerdefinierten Post-Typs betrete, wird in der Seitenleiste “Alle Kategorien” angezeigt. Es sollte “Alle Standorte” sagen.
Wie ändere ich dieses Label?
Fügen Sie dies dem labels
Array hinzu:
'all_items' => __( 'All Locations' ),
Eine vollständige Beschreibung des labels
Arguments finden Sie in der Dokumentation zu register_taxonomy()
.