Make WordPress Core


Ignore:
Timestamp:
09/30/2011 06:07:14 PM (15 years ago)
Author:
ryan
Message:

Consult the main query when determining whether to show the edit menu in the admin bar. This insulates the admin bar from query_posts() queries made by themes and plugins. Props SergeyBiryukov. fixes #16798

File:
1 edited

Legend:

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

    r18788 r18844  
    367367 */
    368368function wp_admin_bar_edit_menu( $wp_admin_bar ) {
    369         global $post, $tag;
     369        global $post, $tag, $wp_the_query;
    370370
    371371        if ( is_admin() ) {
    … …  
    395395                }
    396396        } else {
    397                 $current_object = get_queried_object();
    398 
    399                 if ( empty($current_object) )
     397                $current_object = $wp_the_query->get_queried_object();
     398
     399                if ( empty( $current_object ) )
    400400                        return;
    401401
Note: See TracChangeset for help on using the changeset viewer.