[wp-trac] [WordPress Trac] #23385: Custom Menu metaboxes not shown in the /nav-menus.php page
WordPress Trac
noreply at wordpress.org
Mon Feb 4 22:16:17 UTC 2013
#23385: Custom Menu metaboxes not shown in the /nav-menus.php page
-----------------------------+--------------------------
Reporter: alexvorn2 | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Post Types
Version: 3.5.1 | Severity: major
Keywords: |
-----------------------------+--------------------------
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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23385>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list