[wp-testers] incorrect post counts

Ryan Boren ryan at boren.nu
Tue Feb 5 22:56:44 GMT 2008


On Tue, Feb 5, 2008 at 2:18 PM, ]V[orlock Zernebock <morlockz at gmail.com> wrote:
> Maybe I'm too noob in PHP but I searched for "wp_count_posts" function
>  inside "wp-includes/post.php" and I didn't find it.

svn update to get it.  It's new.

function wp_count_posts( $type = 'post', $status = 'publish' ) {
	global $wpdb;

	return $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM
$wpdb->posts WHERE post_type = %s AND post_status = %s", $type,
$status) );
}


More information about the wp-testers mailing list