Make WordPress Core

Changeset 49067


Ignore:
Timestamp:
09/28/2020 11:52:00 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Avoid a PHP notice in wp_get_shortlink() if the post type is no longer registered.

Props apedog.
Fixes #51376.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r49066 r49067  
    39143914        if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) {
    39153915            $shortlink = home_url( '/' );
    3916         } elseif ( $post_type->public ) {
     3916        } elseif ( $post_type && $post_type->public ) {
    39173917            $shortlink = home_url( '?p=' . $post_id );
    39183918        }
Note: See TracChangeset for help on using the changeset viewer.