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
This commit is contained in:
Andrew Nacin 2010-05-29 16:46:46 +00:00
parent 18eb27afd2
commit 60b96042f2
3 changed files with 11 additions and 4 deletions

View File

@ -386,7 +386,7 @@ function wp_nav_menu_post_type_meta_boxes() {
* @since 3.0.0 * @since 3.0.0
*/ */
function wp_nav_menu_taxonomy_meta_boxes() { 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 ) if ( !$taxonomies )
return; 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 ) { function _wp_nav_menu_meta_box_object( $object = null ) {
if ( isset( $object->name ) ) { if ( isset( $object->name ) ) {
// don't show media meta box
if ( 'attachment' == $object->name )
return false;
if ( 'page' == $object->name ) { if ( 'page' == $object->name ) {
$object->_default_query = array( $object->_default_query = array(

View File

@ -50,6 +50,7 @@ function create_initial_post_types() {
'rewrite' => false, 'rewrite' => false,
'query_var' => false, 'query_var' => false,
'can_export' => false, 'can_export' => false,
'show_in_nav_menus' => false,
) ); ) );
register_post_type( 'revision', array( register_post_type( 'revision', array(

View File

@ -45,6 +45,7 @@ function create_initial_taxonomies() {
'rewrite' => false, 'rewrite' => false,
'show_ui' => false, 'show_ui' => false,
'_builtin' => true, '_builtin' => true,
'show_in_nav_menus' => false,
) ) ; ) ) ;
register_taxonomy( 'link_category', 'link', array( 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; * show_ui - If the WordPress UI admin tags UI should apply to this taxonomy;
* defaults to public. * 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; * show_tagcloud - false to prevent the taxonomy being listed in the Tag Cloud Widget;
* defaults to show_ui which defalts to public. * defaults to show_ui which defalts to public.
* *
@ -264,6 +268,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
'_builtin' => false, '_builtin' => false,
'labels' => array(), 'labels' => array(),
'capabilities' => array(), 'capabilities' => array(),
'show_in_nav_menus' => null,
); );
$args = wp_parse_args($args, $defaults); $args = wp_parse_args($args, $defaults);
@ -286,6 +291,10 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
if ( is_null($args['show_ui']) ) if ( is_null($args['show_ui']) )
$args['show_ui'] = $args['public']; $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']) ) if ( is_null($args['show_tagcloud']) )
$args['show_tagcloud'] = $args['show_ui']; $args['show_tagcloud'] = $args['show_ui'];