WordPress.org

Make WordPress Core

Changeset 40666


Ignore:
Timestamp:
05/14/2017 03:50:01 AM (3 years ago)
Author:
rachelbaker
Message:

Comments: Correct the $post_id parameter passed to the 'comments_open' and 'pings_open' filters.

Fixes bug where previously the $post_id function argument was passed to the '_open' filters, instead of the result of the get_post() call. If the current post is not found, the $post_id filter parameter will be 0.

Props johnbillion, shulard, rachelbaker.
Fixes #40286.

File:
1 edited

Legend:

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

    r40664 r40666  
    11921192    $_post = get_post($post_id);
    11931193
     1194    $post_id = $_post ? $_post->ID : 0;
    11941195    $open = ( 'open' == $_post->comment_status );
    11951196
     
    11991200     * @since 2.5.0
    12001201     *
    1201      * @param bool        $open    Whether the current post is open for comments.
    1202      * @param int|WP_Post $post_id The post ID or WP_Post object.
     1202     * @param bool $open    Whether the current post is open for comments.
     1203     * @param int  $post_id The post ID.
    12031204     */
    12041205    return apply_filters( 'comments_open', $open, $post_id );
     
    12171218    $_post = get_post($post_id);
    12181219
     1220    $post_id = $_post ? $_post->ID : 0;
    12191221    $open = ( 'open' == $_post->ping_status );
    12201222
     
    12241226     * @since 2.5.0
    12251227     *
    1226      * @param bool        $open    Whether the current post is open for pings.
    1227      * @param int|WP_Post $post_id The post ID or WP_Post object.
     1228     * @param bool $open    Whether the current post is open for pings.
     1229     * @param int  $post_id The post ID.
    12281230     */
    12291231    return apply_filters( 'pings_open', $open, $post_id );
Note: See TracChangeset for help on using the changeset viewer.