Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#23385 closed defect (bug) (worksforme)

Custom Menu metaboxes do not show in the /nav-menus.php page

Reported by: alexvorn2's profile alexvorn2 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.1
Component: Menus Keywords:
Focuses: Cc:

Description

The problem: Custom menu metaboxes does not show for custom post type and custom taxonomy after fresh install.

Insert this code into the function.php file (of the Twenty Twelve theme):

function codex_custom_init() {
  $labels = array(
    'name' => 'Books',
    'singular_name' => 'Book',
    'add_new' => 'Add New',
    'add_new_item' => 'Add New Book',
    'edit_item' => 'Edit Book',
    'new_item' => 'New Book',
    'all_items' => 'All Books',
    'view_item' => 'View Book',
    'search_items' => 'Search Books',
    'not_found' =>  'No books found',
    'not_found_in_trash' => 'No books found in Trash', 
    'parent_item_colon' => '',
    'menu_name' => 'Books'
  );

  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => array( 'slug' => 'book' ),
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
  ); 

  register_post_type( 'book', $args );
  

  // Add new taxonomy, make it hierarchical (like categories)
  $labels = array(
    'name'                => _x( 'Genres', 'taxonomy general name' ),
    'singular_name'       => _x( 'Genre', 'taxonomy singular name' ),
    'search_items'        => __( 'Search Genres' ),
    'all_items'           => __( 'All Genres' ),
    'parent_item'         => __( 'Parent Genre' ),
    'parent_item_colon'   => __( 'Parent Genre:' ),
    'edit_item'           => __( 'Edit Genre' ), 
    'update_item'         => __( 'Update Genre' ),
    'add_new_item'        => __( 'Add New Genre' ),
    'new_item_name'       => __( 'New Genre Name' ),
    'menu_name'           => __( 'Genre' )
  ); 	

  $args = array(
    'hierarchical'        => true,
    'labels'              => $labels,
    'show_ui'             => true,
    'show_admin_column'   => true,
    'query_var'           => true,
    'rewrite'             => array( 'slug' => 'genre' )
  );

  register_taxonomy( 'genre', array( 'book' ), $args );

}
add_action( 'init', 'codex_custom_init' );

2) Fresh install of WordPress;
3) Update permalinks;
4) Go to the "/nav-menus.php" page.

Expected to see two menu metaboxes, one for Books and the second for Genres.

Change History (8)

#1 @alexvorn2
12 years ago

  • Component changed from Post Types to Menus

#2 @alexvorn2
12 years ago

  • Summary changed from Custom Menu metaboxes not shown in the /nav-menus.php page to Custom Menu metaboxes do not show in the /nav-menus.php page

#3 @markoheijnen
12 years ago

  • Severity changed from major to normal

Works perfect for me. Not sure what goes wrong for you.

#4 @alexvorn2
12 years ago

Using XAMPP, Windows 7, 32bit and 64bit

#5 @helen
12 years ago

  • Keywords reporter-feedback added

Are they not turned on in screen options?

#6 follow-up: @MikeHansenMe
12 years ago

  • Cc mdhansen@… added

You have to open screen options and check the check boxes for both Books and Genres.

Works for me.

#7 in reply to: ↑ 6 @alexvorn2
12 years ago

  • Keywords reporter-feedback removed
  • Resolution set to fixed
  • Status changed from new to closed

Replying to MikeHansenMe:

You have to open screen options and check the check boxes for both Books and Genres.

Works for me.

I never looked into there before, Thanks for the tip!

It works as MikeHansenMe has suggested.

#8 @helen
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution changed from fixed to worksforme
Note: See TracTickets for help on using tickets.