mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-27 14:53:08 +02:00
After [34444], wp_get_shortlink()
can call get_queried_object_id()
instead of using the $wp_query
global.
See #14900. Built from https://develop.svn.wordpress.org/trunk@34445 git-svn-id: http://core.svn.wordpress.org/trunk@34409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7cbd096c2b
commit
d866a40d09
@ -3471,8 +3471,6 @@ function rel_canonical() {
|
|||||||
*
|
*
|
||||||
* @since 3.0.0.
|
* @since 3.0.0.
|
||||||
*
|
*
|
||||||
* @global WP_Query $wp_query
|
|
||||||
*
|
|
||||||
* @param int $id A post or blog id. Default is 0, which means the current post or blog.
|
* @param int $id A post or blog id. Default is 0, which means the current post or blog.
|
||||||
* @param string $context Whether the id is a 'blog' id, 'post' id, or 'media' id.
|
* @param string $context Whether the id is a 'blog' id, 'post' id, or 'media' id.
|
||||||
* If 'post', the post_type of the post is consulted.
|
* If 'post', the post_type of the post is consulted.
|
||||||
@ -3497,13 +3495,13 @@ function wp_get_shortlink($id = 0, $context = 'post', $allow_slugs = true) {
|
|||||||
*/
|
*/
|
||||||
$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
|
$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
|
||||||
|
|
||||||
if ( false !== $shortlink )
|
if ( false !== $shortlink ) {
|
||||||
return $shortlink;
|
return $shortlink;
|
||||||
|
}
|
||||||
|
|
||||||
global $wp_query;
|
|
||||||
$post_id = 0;
|
$post_id = 0;
|
||||||
if ( 'query' == $context && is_singular() ) {
|
if ( 'query' == $context && is_singular() ) {
|
||||||
$post_id = $wp_query->get_queried_object_id();
|
$post_id = get_queried_object_id();
|
||||||
$post = get_post( $post_id );
|
$post = get_post( $post_id );
|
||||||
} elseif ( 'post' == $context ) {
|
} elseif ( 'post' == $context ) {
|
||||||
$post = get_post( $id );
|
$post = get_post( $id );
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34444';
|
$wp_version = '4.4-alpha-34445';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user