Return an empty stdClass from wp_count_posts() when a nonexistent post type is requested.

props johnpbloch.
fixes #24803.



git-svn-id: http://core.svn.wordpress.org/trunk@24826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-07-28 21:38:00 +00:00
parent f19377fb81
commit 87f9d112c0
1 changed files with 3 additions and 0 deletions

View File

@ -2042,6 +2042,9 @@ function unstick_post($post_id) {
function wp_count_posts( $type = 'post', $perm = '' ) { function wp_count_posts( $type = 'post', $perm = '' ) {
global $wpdb; global $wpdb;
if ( ! post_type_exists( $type ) )
return new stdClass;
$user = wp_get_current_user(); $user = wp_get_current_user();
$cache_key = $type; $cache_key = $type;