Add wp_count_posts().

git-svn-id: https://develop.svn.wordpress.org/trunk@6730 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-02-05 19:08:14 +00:00
parent fa13bbbd58
commit e96e46aec6
2 changed files with 23 additions and 4 deletions

View File

@@ -789,6 +789,25 @@ function sanitize_post_field($field, $value, $post_id, $context) {
return $value;
}
/**
* wp_count_posts() - Count number of posts with a given type and status
*
* {@internal Missing Long Description}}
*
* @package WordPress
* @subpackage Post
* @since 2.5
*
* @param string $type Post type
* @param string $status Post status
* @return int Number of posts
*/
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) );
}
/**
* wp_delete_post() - Deletes a Post
*