Clean up logic when selecting post types for the admin bar content drop-down. see #15308.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-11-18 09:01:07 +00:00
parent f9434dc3f6
commit d32722275e

View File

@ -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" );
}