diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index f70c4aee1a..930e33d883 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -3158,7 +3158,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 78d771bc3d..f2cc5b598c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42579'; +$wp_version = '5.0-alpha-42581'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.