Make WordPress Core

Changeset 16114


Ignore:
Timestamp:
10/31/2010 11:02:17 AM (14 years ago)
Author:
scribu
Message:

use get_queried_object() wrappers throughout. See #14015

Location:
trunk/wp-includes
Files:
5 edited

Legend:

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

    r16098 r16114  
    174174 */
    175175function wp_admin_bar_edit_menu () {
    176     global $wp_admin_bar, $wp_query;
    177 
    178     $current_object = $wp_query->get_queried_object();
     176    global $wp_admin_bar;
     177
     178    $current_object = get_queried_object();
    179179
    180180    if ( empty($current_object) )
  • trunk/wp-includes/category-template.php

    r16100 r16114  
    466466        }
    467467    } else {
    468         global $wp_query;
    469 
    470468        if( !empty( $show_option_all ) )
    471469            if ( 'list' == $style )
     
    475473
    476474        if ( empty( $r['current_category'] ) && ( is_category() || is_tax() ) )
    477             $r['current_category'] = $wp_query->get_queried_object_id();
     475            $r['current_category'] = get_queried_object_id();
    478476
    479477        if ( $hierarchical )
     
    10261024function term_description( $term = 0, $taxonomy = 'post_tag' ) {
    10271025    if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
    1028         global $wp_query;
    1029         $term = $wp_query->get_queried_object();
     1026        $term = get_queried_object();
    10301027        $taxonomy = $term->taxonomy;
    10311028        $term = $term->term_id;
  • trunk/wp-includes/general-template.php

    r16066 r16114  
    527527 */
    528528function wp_title($sep = '»', $display = true, $seplocation = '') {
    529     global $wpdb, $wp_locale, $wp_query;
     529    global $wpdb, $wp_locale;
    530530
    531531    $m = get_query_var('m');
     
    556556    // If there's an author
    557557    if ( is_author() ) {
    558         $author = $wp_query->get_queried_object();
     558        $author = get_queried_object();
    559559        $title = $author->display_name;
    560560    }
     
    634634 */
    635635function single_post_title($prefix = '', $display = true) {
    636     global $wp_query, $post;
     636    global $post;
    637637
    638638    if ( ! $post )
    639         $_post = $wp_query->get_queried_object();
     639        $_post = get_queried_object();
    640640    else
    641641        $_post = $post;
     
    737737 */
    738738function single_term_title( $prefix = '', $display = true ) {
    739     global $wp_query;
    740 
    741     $term = $wp_query->get_queried_object();
     739    $term = get_queried_object();
    742740
    743741    if ( !$term )
     
    16311629 */
    16321630function feed_links_extra( $args = array() ) {
    1633     global $wp_query;
    1634 
    16351631    $defaults = array(
    16361632        /* translators: Separator between blog name and feed type in feed links */
     
    16581654        }
    16591655    } elseif ( is_category() ) {
    1660         $term = $wp_query->get_queried_object();
     1656        $term = get_queried_object();
    16611657
    16621658        $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name ));
    16631659        $href = get_category_feed_link( $term->term_id );
    16641660    } elseif ( is_tag() ) {
    1665         $term = $wp_query->get_queried_object();
     1661        $term = get_queried_object();
    16661662
    16671663        $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name ));
  • trunk/wp-includes/link-template.php

    r16083 r16114  
    717717function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {
    718718    if ( is_null( $term ) ) {
    719         global $wp_query;
    720         $term = $wp_query->get_queried_object();
     719        $term = get_queried_object();
    721720    }
    722721
  • trunk/wp-includes/theme.php

    r16029 r16114  
    856856 */
    857857function get_tag_template() {
    858     global $wp_query;
    859 
    860     $tag = $wp_query->get_queried_object();
     858    $tag = get_queried_object();
    861859    $tag_name = $tag->slug;
    862860    $tag_id = $tag->term_id;
     
    962960 */
    963961function get_page_template() {
    964     global $wp_query;
    965 
    966     $id = (int) $wp_query->get_queried_object_id();
     962    $id = get_queried_object_id();
    967963    $template = get_post_meta($id, '_wp_page_template', true);
    968964    $pagename = get_query_var('pagename');
     
    970966    if ( !$pagename && $id > 0 ) {
    971967        // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
    972         $post = $wp_query->get_queried_object();
     968        $post = get_queried_object();
    973969        $pagename = $post->post_name;
    974970    }
     
    10191015 */
    10201016function get_single_template() {
    1021     global $wp_query;
    1022 
    1023     $object = $wp_query->get_queried_object();
     1017    $object = get_queried_object();
    10241018    $templates = array('single-' . $object->post_type . '.php', 'single.php');
    10251019
Note: See TracChangeset for help on using the changeset viewer.