Make WordPress Core

Changeset 34445


Ignore:
Timestamp:
09/22/2015 08:08:49 PM (9 years ago)
Author:
wonderboymusic
Message:

After [34444​], wp_get_shortlink() can call get_queried_object_id() instead of using the $wp_query global.

See #14900.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r34444 r34445  
    34723472 * @since 3.0.0.
    34733473 *
    3474  * @global WP_Query $wp_query
    3475  *
    34763474 * @param int    $id          A post or blog id. Default is 0, which means the current post or blog.
    34773475 * @param string $context     Whether the id is a 'blog' id, 'post' id, or 'media' id.
     
    34983496    $shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
    34993497
    3500     if ( false !== $shortlink )
     3498    if ( false !== $shortlink ) {
    35013499        return $shortlink;
    3502 
    3503     global $wp_query;
     3500    }
     3501
    35043502    $post_id = 0;
    35053503    if ( 'query' == $context && is_singular() ) {
    3506         $post_id = $wp_query->get_queried_object_id();
     3504        $post_id = get_queried_object_id();
    35073505        $post = get_post( $post_id );
    35083506    } elseif ( 'post' == $context ) {
Note: See TracChangeset for help on using the changeset viewer.