Make WordPress Core

Ticket #51376: 51376.diff

File 51376.diff, 928 bytes (added by apedog, 4 years ago)
  • wp-includes/link-template.php

    diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
    index 58366208b1..18cd209f28 100644
    a b function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) { 
    39083908        if ( ! empty( $post_id ) ) {
    39093909                $post_type = get_post_type_object( $post->post_type );
    39103910
    3911                 if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) {
    3912                         $shortlink = home_url( '/' );
    3913                 } elseif ( $post_type->public ) {
    3914                         $shortlink = home_url( '?p=' . $post_id );
     3911                if ( ! empty( $post_type ) ) {
     3912                        if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) {
     3913                                $shortlink = home_url( '/' );
     3914                        } elseif ( $post_type->public ) {
     3915                                $shortlink = home_url( '?p=' . $post_id );
     3916                        }
    39153917                }
    39163918        }
    39173919