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. Built from https://develop.svn.wordpress.org/trunk@36480 git-svn-id: http://core.svn.wordpress.org/trunk@36447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8e5cf1c2fe
commit
b5d12e130c
|
@ -33,14 +33,14 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
*
|
||||
* @see WP_List_Table::__construct() for more information on default arguments.
|
||||
*
|
||||
* @global int|bool $post_id
|
||||
* @global int $post_id
|
||||
*
|
||||
* @param array $args An associative array of arguments.
|
||||
*/
|
||||
public function __construct( $args = array() ) {
|
||||
global $post_id;
|
||||
|
||||
$post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : false;
|
||||
$post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
|
||||
|
||||
if ( get_option( 'show_avatars' ) ) {
|
||||
add_filter( 'comment_author', array( $this, 'floated_admin_avatar' ), 10, 2 );
|
||||
|
@ -69,7 +69,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
|
||||
/**
|
||||
*
|
||||
* @global int|bool $post_id
|
||||
* @global int $post_id
|
||||
* @global string $comment_status
|
||||
* @global string $search
|
||||
* @global string $comment_type
|
||||
|
@ -192,7 +192,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
|
||||
/**
|
||||
*
|
||||
* @global int|bool $post_id
|
||||
* @global int $post_id
|
||||
* @global string $comment_status
|
||||
* @global string $comment_type
|
||||
*/
|
||||
|
@ -383,7 +383,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
|
||||
/**
|
||||
*
|
||||
* @global int|bool $post_id
|
||||
* @global int $post_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36479';
|
||||
$wp_version = '4.5-alpha-36480';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue