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. Built from https://develop.svn.wordpress.org/trunk@40666 git-svn-id: http://core.svn.wordpress.org/trunk@40529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
62de6cc7ec
commit
9c2f5c18ce
|
@ -1191,6 +1191,7 @@ function comments_open( $post_id = null ) {
|
||||||
|
|
||||||
$_post = get_post($post_id);
|
$_post = get_post($post_id);
|
||||||
|
|
||||||
|
$post_id = $_post ? $_post->ID : 0;
|
||||||
$open = ( 'open' == $_post->comment_status );
|
$open = ( 'open' == $_post->comment_status );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1198,8 +1199,8 @@ function comments_open( $post_id = null ) {
|
||||||
*
|
*
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*
|
*
|
||||||
* @param bool $open Whether the current post is open for comments.
|
* @param bool $open Whether the current post is open for comments.
|
||||||
* @param int|WP_Post $post_id The post ID or WP_Post object.
|
* @param int $post_id The post ID.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'comments_open', $open, $post_id );
|
return apply_filters( 'comments_open', $open, $post_id );
|
||||||
}
|
}
|
||||||
|
@ -1216,6 +1217,7 @@ function pings_open( $post_id = null ) {
|
||||||
|
|
||||||
$_post = get_post($post_id);
|
$_post = get_post($post_id);
|
||||||
|
|
||||||
|
$post_id = $_post ? $_post->ID : 0;
|
||||||
$open = ( 'open' == $_post->ping_status );
|
$open = ( 'open' == $_post->ping_status );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1223,8 +1225,8 @@ function pings_open( $post_id = null ) {
|
||||||
*
|
*
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*
|
*
|
||||||
* @param bool $open Whether the current post is open for pings.
|
* @param bool $open Whether the current post is open for pings.
|
||||||
* @param int|WP_Post $post_id The post ID or WP_Post object.
|
* @param int $post_id The post ID.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'pings_open', $open, $post_id );
|
return apply_filters( 'pings_open', $open, $post_id );
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-beta1-40665';
|
$wp_version = '4.8-beta1-40666';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue