mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Comments: Restore the ability to bypass post_id filter using 0 or '0'.
The changes introduced in [36381], while logical and clearly awesome, introduce the potential for much breakage. Those who want to query for comments with a null `comment_post_ID` should use `'post_in' => array( 0 )` instead. Reverts [36381], [36387]. See #35090. git-svn-id: https://develop.svn.wordpress.org/trunk@36480 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -214,7 +214,7 @@ class WP_Comment_Query {
|
||||
* Default empty.
|
||||
* @type int $post_ID Currently unused.
|
||||
* @type int $post_id Limit results to those affiliated with a given post ID.
|
||||
* Default null.
|
||||
* Default 0.
|
||||
* @type array $post__in Array of post IDs to include affiliated comments for.
|
||||
* Default empty.
|
||||
* @type array $post__not_in Array of post IDs to exclude affiliated comments for.
|
||||
@@ -278,7 +278,7 @@ class WP_Comment_Query {
|
||||
'post_author__in' => '',
|
||||
'post_author__not_in' => '',
|
||||
'post_ID' => '',
|
||||
'post_id' => null,
|
||||
'post_id' => 0,
|
||||
'post__in' => '',
|
||||
'post__not_in' => '',
|
||||
'post_author' => '',
|
||||
@@ -647,8 +647,9 @@ class WP_Comment_Query {
|
||||
$fields = "$wpdb->comments.comment_ID";
|
||||
}
|
||||
|
||||
if ( strlen( $this->query_vars['post_id'] ) ) {
|
||||
$this->sql_clauses['where']['post_id'] = $wpdb->prepare( 'comment_post_ID = %d', $this->query_vars['post_id'] );
|
||||
$post_id = absint( $this->query_vars['post_id'] );
|
||||
if ( ! empty( $post_id ) ) {
|
||||
$this->sql_clauses['where']['post_id'] = $wpdb->prepare( 'comment_post_ID = %d', $post_id );
|
||||
}
|
||||
|
||||
// Parse comment IDs for an IN clause.
|
||||
|
||||
Reference in New Issue
Block a user