Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions src/wp-includes/class-wp-date-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,16 +482,23 @@ public function validate_column( $column ) {
global $wpdb;

$valid_columns = array(
'post_date',
'post_date_gmt',
'post_modified',
'post_modified_gmt',
'comment_date',
'comment_date_gmt',
'user_registered',
'registered',
'last_updated',
'post_date', // Part of $wpdb->posts.
'post_date_gmt', // Part of $wpdb->posts.
'post_modified', // Part of $wpdb->posts.
'post_modified_gmt', // Part of $wpdb->posts.
'comment_date', // Part of $wpdb->comments.
'comment_date_gmt', // Part of $wpdb->comments.
'user_registered', // Part of $wpdb->users.
);
if ( is_multisite() ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( is_multisite() ) {
if ( is_multisite() ) {

$valid_columns = array_merge(
$valid_columns,
array(
'registered', // Part of $wpdb->blogs.
'last_updated', // Part of $wpdb->blogs.
)
);
}

// Attempt to detect a table prefix.
if ( ! str_contains( $column, '.' ) ) {
Expand Down Expand Up @@ -525,11 +532,13 @@ public function validate_column( $column ) {
$wpdb->users => array(
'user_registered',
),
$wpdb->blogs => array(
);
if ( is_multisite() ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ( is_multisite() ) {
if ( is_multisite() ) {

$known_columns[ $wpdb->blogs ] = array(
'registered',
'last_updated',
),
);
);
}

// If it's a known column name, add the appropriate table prefix.
foreach ( $known_columns as $table_name => $table_columns ) {
Expand Down
14 changes: 7 additions & 7 deletions src/wp-includes/class-wpdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ class wpdb {
*
* @since 3.0.0
*
* @var string
* @var string|null
*/
public $blogs;

Expand All @@ -476,7 +476,7 @@ class wpdb {
*
* @since 5.1.0
*
* @var string
* @var string|null
*/
public $blogmeta;

Expand All @@ -485,7 +485,7 @@ class wpdb {
*
* @since 3.0.0
*
* @var string
* @var string|null
*/
public $registration_log;

Expand All @@ -494,7 +494,7 @@ class wpdb {
*
* @since 3.0.0
*
* @var string
* @var string|null
*/
public $signups;

Expand All @@ -503,7 +503,7 @@ class wpdb {
*
* @since 3.0.0
*
* @var string
* @var string|null
*/
public $site;

Expand All @@ -512,7 +512,7 @@ class wpdb {
*
* @since 3.0.0
*
* @var string
* @var string|null
*/
public $sitecategories;

Expand All @@ -521,7 +521,7 @@ class wpdb {
*
* @since 3.0.0
*
* @var string
* @var string|null
*/
public $sitemeta;

Expand Down
Loading