Make WordPress Core

Ticket #54159: 54159.diff

File 54159.diff, 2.1 KB (added by dd32, 2 years ago)
  • wp-includes/comment-template.php

    function trackback_rdf( $deprecated = '' 
    12291229 *
    12301230 * For more information on this and similar theme functions, check out
    12311231 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
    12321232 * Conditional Tags} article in the Theme Developer Handbook.
    12331233 *
    12341234 * @since 1.5.0
    12351235 *
    12361236 * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post.
    12371237 * @return bool True if the comments are open.
    12381238 */
    12391239function comments_open( $post_id = null ) {
    12401240
    12411241        $_post = get_post( $post_id );
    12421242
    12431243        $post_id = $_post ? $_post->ID : 0;
    1244         $open    = ( 'open' === $_post->comment_status );
     1244        $open    = $_post && ( 'open' === $_post->comment_status );
    12451245
    12461246        /**
    12471247         * Filters whether the current post is open for comments.
    12481248         *
    12491249         * @since 2.5.0
    12501250         *
    12511251         * @param bool $open    Whether the current post is open for comments.
    12521252         * @param int  $post_id The post ID.
    12531253         */
    12541254        return apply_filters( 'comments_open', $open, $post_id );
    12551255}
    12561256
    12571257/**
    12581258 * Determines whether the current post is open for pings.
    12591259 *
    12601260 * For more information on this and similar theme functions, check out
    12611261 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
    12621262 * Conditional Tags} article in the Theme Developer Handbook.
    12631263 *
    12641264 * @since 1.5.0
    12651265 *
    12661266 * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post.
    12671267 * @return bool True if pings are accepted
    12681268 */
    12691269function pings_open( $post_id = null ) {
    12701270
    12711271        $_post = get_post( $post_id );
    12721272
    12731273        $post_id = $_post ? $_post->ID : 0;
    1274         $open    = ( 'open' === $_post->ping_status );
     1274        $open    = $_post && ( 'open' === $_post->ping_status );
    12751275
    12761276        /**
    12771277         * Filters whether the current post is open for pings.
    12781278         *
    12791279         * @since 2.5.0
    12801280         *
    12811281         * @param bool $open    Whether the current post is open for pings.
    12821282         * @param int  $post_id The post ID.
    12831283         */
    12841284        return apply_filters( 'pings_open', $open, $post_id );
    12851285}
    12861286
    12871287/**
    12881288 * Displays form token for unfiltered comments.
    12891289 *