From d1603a424619bc0b200366bb753c341f58a8b91f Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 16 Mar 2010 17:22:24 +0000 Subject: [PATCH] Introduce taxonomies_allowed_in_menus and post_types_allowed_in_menus. Show only pages and categories by default. see #11817 git-svn-id: https://develop.svn.wordpress.org/trunk@13716 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/nav-menu.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index fe100a45f9..38fc91a953 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -16,8 +16,11 @@ function wp_nav_menu_post_type_metaboxes() { if ( !$post_types ) return false; - - foreach ( $post_types as $post_type ) { + + $allowed_types = apply_filters('post_types_allowed_in_menus', array('page')); + foreach ( $post_types as $post_type ) { + if ( !in_array($post_type->name, $allowed_types) ) + continue; $id = sanitize_title_with_dashes( $post_type->label ); // delete_transient( "nav_menu_items_{$post_type->name}" ); @@ -37,9 +40,13 @@ function wp_nav_menu_taxonomy_metaboxes() { if ( !$taxonomies ) return false; - + + $allowed_types = apply_filters('taxonomies_allowed_in_menus', array('category')); foreach ( $taxonomies as $tax ) { + if ( !in_array($tax->name, $allowed_types) ) + continue; $id = sanitize_title_with_dashes( $tax->label ); + // delete_transient( "nav_menu_items_{$tax->name}" ); // delete_transient( "nav_menu_sub_items_{$tax->name}" );