From 87f9d112c09674a7c7c7ea1e35afd866898a44f9 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sun, 28 Jul 2013 21:38:00 +0000 Subject: [PATCH] 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 --- wp-includes/post.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-includes/post.php b/wp-includes/post.php index 8b97e4ef12..18544599a5 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2042,6 +2042,9 @@ function unstick_post($post_id) { function wp_count_posts( $type = 'post', $perm = '' ) { global $wpdb; + if ( ! post_type_exists( $type ) ) + return new stdClass; + $user = wp_get_current_user(); $cache_key = $type;