From 60b96042f2e4d335889164df2d335197b6e45360 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 29 May 2010 16:46:46 +0000 Subject: [PATCH] Use show_in_nav_menus for attachments. Also add it to register_taxonomy for consistency and have it default to public, not show_ui, like post types. see #13621. git-svn-id: https://develop.svn.wordpress.org/trunk@15056 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/nav-menu.php | 5 +---- wp-includes/post.php | 1 + wp-includes/taxonomy.php | 9 +++++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index b3ea39b1c5..b7c3333ce8 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -386,7 +386,7 @@ function wp_nav_menu_post_type_meta_boxes() { * @since 3.0.0 */ function wp_nav_menu_taxonomy_meta_boxes() { - $taxonomies = get_taxonomies( array( 'show_ui' => true ), 'object' ); + $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' ); if ( !$taxonomies ) return; @@ -952,9 +952,6 @@ function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) { */ function _wp_nav_menu_meta_box_object( $object = null ) { if ( isset( $object->name ) ) { - // don't show media meta box - if ( 'attachment' == $object->name ) - return false; if ( 'page' == $object->name ) { $object->_default_query = array( diff --git a/wp-includes/post.php b/wp-includes/post.php index f43099abdc..c9cfd6c32c 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -50,6 +50,7 @@ function create_initial_post_types() { 'rewrite' => false, 'query_var' => false, 'can_export' => false, + 'show_in_nav_menus' => false, ) ); register_post_type( 'revision', array( diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 73145528e2..bed3f5ee8e 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -45,6 +45,7 @@ function create_initial_taxonomies() { 'rewrite' => false, 'show_ui' => false, '_builtin' => true, + 'show_in_nav_menus' => false, ) ) ; register_taxonomy( 'link_category', 'link', array( @@ -232,6 +233,9 @@ function is_taxonomy_hierarchical($taxonomy) { * show_ui - If the WordPress UI admin tags UI should apply to this taxonomy; * defaults to public. * + * show_in_nav_menus - true makes this taxonomy available for selection in navigation menus. + * Defaults to public. + * * show_tagcloud - false to prevent the taxonomy being listed in the Tag Cloud Widget; * defaults to show_ui which defalts to public. * @@ -264,6 +268,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { '_builtin' => false, 'labels' => array(), 'capabilities' => array(), + 'show_in_nav_menus' => null, ); $args = wp_parse_args($args, $defaults); @@ -286,6 +291,10 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { if ( is_null($args['show_ui']) ) $args['show_ui'] = $args['public']; + // Whether to show this type in nav-menus.php. Defaults to the setting for public. + if ( null === $args['show_in_nav_menus'] ) + $args['show_in_nav_menus'] = $args['public']; + if ( is_null($args['show_tagcloud']) ) $args['show_tagcloud'] = $args['show_ui'];