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
This commit is contained in:
parent
1c4c2a2ad9
commit
3161d152bf
@ -193,11 +193,9 @@ function wp_admin_bar_new_content_menu() {
|
|||||||
global $wp_admin_bar;
|
global $wp_admin_bar;
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
foreach ( (array) get_post_types( array('show_ui' => true, 'show_in_menu' => true) ) as $ptype ) {
|
foreach ( (array) get_post_types( array( 'show_ui' => true ), 'objects' ) as $ptype_obj ) {
|
||||||
$ptype_obj = get_post_type_object( $ptype );
|
if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap->edit_posts ) )
|
||||||
if ( $ptype_obj->show_in_menu !== true || ! current_user_can( $ptype_obj->cap->edit_posts ) )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$actions["post-new.php?post_type=$ptype"] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->edit_posts, "new-$ptype" );
|
$actions["post-new.php?post_type=$ptype"] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->edit_posts, "new-$ptype" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user