Make wp_get_shortlink() loop friendly. Fixes #13212 props ryan.
git-svn-id: https://develop.svn.wordpress.org/trunk@14490 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8e2343b6ba
commit
85e9d665ee
|
@ -2172,10 +2172,12 @@ function wp_get_shortlink($id = 0, $context = 'post', $allow_slugs = true) {
|
||||||
|
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
$post_id = 0;
|
$post_id = 0;
|
||||||
if ( 'query' == $context && is_single() )
|
if ( 'query' == $context && is_single() ) {
|
||||||
$post_id = $wp_query->get_queried_object_id();
|
$post_id = $wp_query->get_queried_object_id();
|
||||||
elseif ( 'post' == $context )
|
} elseif ( 'post' == $context ) {
|
||||||
$post_id = $id;
|
$post = get_post($id);
|
||||||
|
$post_id = $post->ID;
|
||||||
|
}
|
||||||
|
|
||||||
$shortlink = '';
|
$shortlink = '';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue