0

I've just created a custom taxonomy to add a 'page type' to different pages in a WordPress site. They can be added to a page fine but unfortunately I cannot add these taxonomies to any menu in the CMS. Each page will be set to 'Male', 'Female' or 'Info' so it would be great to have these as menu items. I've provided the code below, any help would be greatly appreciated! Thanks!

function add_custom_taxonomies() {
  // Add new "Locations" taxonomy to Posts
  register_taxonomy('Page-type', 'page', array(
    // Hierarchical taxonomy (like categories)
    'hierarchical' => true,
    // This array of options controls the labels displayed in the WordPress Admin UI
    'labels' => array(
      'name' => _x( 'Page Types', 'taxonomy general name' ),
      'singular_name' => _x( 'Page Type', 'taxonomy singular name' ),
      'search_items' =>  __( 'Search page types' ),
      'all_items' => __( 'All page types' ),
      'parent_item' => __( 'Parent page type' ),
      'parent_item_colon' => __( 'Parent page type:' ),
      'edit_item' => __( 'Edit page type' ),
      'update_item' => __( 'Update page type' ),
      'add_new_item' => __( 'Add new page type' ),
      'new_item_name' => __( 'New page type Name' ),
      'menu_name' => __( 'Page Types' ),
    ),
    // Control the slugs used for this taxonomy
    'rewrite' => array(
      'slug' => 'page-types', // This controls the base slug that will display before each term
      'with_front' => false, // Don't display the category base before "/locations/"
      'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
    ),
  ));
}
add_action( 'init', 'add_custom_taxonomies', 0 );
Chuck
  • 119
  • 3
  • 20

2 Answers2

0

Due to database structure restrictions the taxonomy name should only contain lowercase letters and the underscore character, and not be more than 32 characters long (Codex).

diggy
  • 6,748
  • 2
  • 18
  • 24
0

Taxonomy name should be lower case otherwise it not show in menu and also 'show_in_nav_menus' should be true..