diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index afc8f9691a..a6c248a7bf 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -3032,7 +3032,15 @@ class WP_Query { */ $this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) ); } else { - $this->found_posts = count( $this->posts ); + if ( is_array( $this->posts ) ) { + $this->found_posts = count( $this->posts ); + } else { + if ( null === $this->posts ) { + $this->found_posts = 0; + } else { + $this->found_posts = 1; + } + } } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index e0aef37b81..1f77a2e11d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.3-alpha-42596'; +$wp_version = '4.9.3-alpha-42597'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.