Make WordPress Core

Changeset 16462


Ignore:
Timestamp:
11/18/2010 09:01:07 AM (14 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/admin-bar.php

    r16438 r16462  
    194194
    195195    $actions = array();
    196     foreach ( (array) get_post_types( array('show_ui' => true, 'show_in_menu' => true) ) as $ptype ) {
    197         $ptype_obj = get_post_type_object( $ptype );
    198         if ( $ptype_obj->show_in_menu !== true || ! current_user_can( $ptype_obj->cap->edit_posts ) )
     196    foreach ( (array) get_post_types( array( 'show_ui' => true ), 'objects' ) as $ptype_obj ) {
     197        if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap->edit_posts ) )
    199198            continue;
    200 
    201199        $actions["post-new.php?post_type=$ptype"] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->edit_posts, "new-$ptype" );
    202200    }
Note: See TracChangeset for help on using the changeset viewer.