mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-08 16:41:44 +01:00
Fix the failing Tests_Link::test_wp_get_shortlink()
assertion:
* `wp_get_shortlink()` was firing a notice when reading `$post->ID` while `$post` was null in some cases * Before the assertions that assume `$GLOBALS['post']` is not set, call `unset( $GLOBALS['post'] );` - there was global spillage from other tests See #25282. Built from https://develop.svn.wordpress.org/trunk@25404 git-svn-id: http://core.svn.wordpress.org/trunk@25334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0758df9758
commit
acf3ee37e3
@ -2417,7 +2417,8 @@ function wp_get_shortlink($id = 0, $context = 'post', $allow_slugs = true) {
|
|||||||
$post = get_post( $post_id );
|
$post = get_post( $post_id );
|
||||||
} elseif ( 'post' == $context ) {
|
} elseif ( 'post' == $context ) {
|
||||||
$post = get_post( $id );
|
$post = get_post( $id );
|
||||||
$post_id = $post->ID;
|
if ( ! empty( $post->ID ) )
|
||||||
|
$post_id = $post->ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
$shortlink = '';
|
$shortlink = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user