diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 58366208b1..faa00162a8 100644
a
|
b
|
function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) { |
3906 | 3906 | |
3907 | 3907 | // Return `?p=` link for all public post types. |
3908 | 3908 | if ( ! empty( $post_id ) ) { |
3909 | | $post_type = get_post_type_object( $post->post_type ); |
3910 | | |
3911 | 3909 | if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) { |
3912 | 3910 | $shortlink = home_url( '/' ); |
3913 | | } elseif ( $post_type->public ) { |
3914 | | $shortlink = home_url( '?p=' . $post_id ); |
| 3911 | } else { |
| 3912 | $post_type = get_post_type_object( $post->post_type ); |
| 3913 | |
| 3914 | if ( ! is_null( $post_type ) && $post_type->public ) { |
| 3915 | $shortlink = home_url( '?p=' . $post_id ); |
| 3916 | } |
3915 | 3917 | } |
3916 | 3918 | } |
3917 | 3919 | |