Add show_in_nav_menus flag to post type registration. Props williamsba1. fixes #13144

git-svn-id: http://svn.automattic.com/wordpress/trunk@14602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-05-13 17:29:45 +00:00
parent e4ca88c1e8
commit 067fc117cb
2 changed files with 6 additions and 2 deletions

View File

@ -362,7 +362,7 @@ function wp_initial_nav_menu_meta_boxes() {
* @since 3.0.0
*/
function wp_nav_menu_post_type_meta_boxes() {
$post_types = get_post_types( array( 'public' => true ), 'object' );
$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
if ( ! $post_types )
return;

View File

@ -800,7 +800,7 @@ function register_post_type($post_type, $args = array()) {
'_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'capabilities' => array(), 'hierarchical' => false,
'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null,
'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null,
'permalink_epmask' => EP_PERMALINK, 'can_export' => true,
'permalink_epmask' => EP_PERMALINK, 'can_export' => true, 'show_in_nav_menus' => null
);
$args = wp_parse_args($args, $defaults);
$args = (object) $args;
@ -816,6 +816,10 @@ function register_post_type($post_type, $args = array()) {
if ( 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 not set, default to true if not public, false if public.
if ( null === $args->exclude_from_search )
$args->exclude_from_search = !$args->public;