How to return count number from a wordpress database
It is recommended to use the $wpdb->get_var() method when retrieving a count of rows. This method will return the count directly, rather than inside of an array or object like wpdb::get_results().