Add wp_count_posts().
git-svn-id: http://svn.automattic.com/wordpress/trunk@6730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user