From 3161d152bf88caa1de4429edd4e7fa523e0004b6 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 18 Nov 2010 09:01:07 +0000 Subject: [PATCH] Clean up logic when selecting post types for the admin bar content drop-down. see #15308. git-svn-id: https://develop.svn.wordpress.org/trunk@16462 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/admin-bar.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 4ac368de8b..8f4df8a5a2 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -193,11 +193,9 @@ function wp_admin_bar_new_content_menu() { global $wp_admin_bar; $actions = array(); - foreach ( (array) get_post_types( array('show_ui' => true, 'show_in_menu' => true) ) as $ptype ) { - $ptype_obj = get_post_type_object( $ptype ); - if ( $ptype_obj->show_in_menu !== true || ! current_user_can( $ptype_obj->cap->edit_posts ) ) + foreach ( (array) get_post_types( array( 'show_ui' => true ), 'objects' ) as $ptype_obj ) { + if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap->edit_posts ) ) continue; - $actions["post-new.php?post_type=$ptype"] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->edit_posts, "new-$ptype" ); }