Make WordPress Core

Ticket #51376: 51376.alt.diff

File 51376.alt.diff, 874 bytes (added by apedog, 5 years ago)

51376 - alternative patch

  • wp-includes/link-template.php

    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 ) { 
    39063906
    39073907        // Return `?p=` link for all public post types.
    39083908        if ( ! empty( $post_id ) ) {
    3909                 $post_type = get_post_type_object( $post->post_type );
    3910 
    39113909                if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) {
    39123910                        $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                        }
    39153917                }
    39163918        }
    39173919