From 41681b29b0b6fe100dd5efc7e4c3d6d97e61130c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 28 Sep 2020 11:53:08 +0000 Subject: [PATCH] Posts, Post Types: Avoid a PHP notice in `wp_get_shortlink()` if the post type is no longer registered. Props apedog. Fixes #51376. Built from https://develop.svn.wordpress.org/trunk@49067 git-svn-id: http://core.svn.wordpress.org/trunk@48829 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index e913f3bf58..b1294db5be 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -3913,7 +3913,7 @@ function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) { if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) { $shortlink = home_url( '/' ); - } elseif ( $post_type->public ) { + } elseif ( $post_type && $post_type->public ) { $shortlink = home_url( '?p=' . $post_id ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index cc56af815e..1d00974a4b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-49066'; +$wp_version = '5.6-alpha-49067'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.