Skip to content

Commit 16e6de8

Browse files
committed
Weston's Fix: Update wp_dashboard_right_now to use post type objects and simplify logic;
1 parent 4928cc7 commit 16e6de8

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/wp-admin/includes/dashboard.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,16 +303,12 @@ function wp_dashboard_right_now() {
303303
<ul>
304304
<?php
305305
// At a Glance Post Types.
306-
foreach ( get_post_types( array( 'at_a_glance' => true ) ) as $post_type ) {
306+
foreach ( get_post_types( array( 'at_a_glance' => true ), 'objects' ) as $post_type_object ) {
307+
$post_type = $post_type_object->name;
307308
$num_posts = wp_count_posts( $post_type );
308309
$num_post_published = intval( $num_posts->publish );
309310

310311
if ( $num_posts && $num_post_published ) {
311-
$post_type_object = get_post_type_object( $post_type );
312-
313-
if ( ! $post_type_object ) {
314-
continue;
315-
}
316312
if ( 1 === $num_post_published ) {
317313
$post_label = $post_type_object->labels->singular_name;
318314
} else {

src/wp-includes/class-wp-post-type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ final class WP_Post_Type {
199199
* @since 4.6.0
200200
* @var string $menu_icon
201201
*/
202-
public $menu_icon = null;
202+
public $menu_icon;
203203

204204
/**
205205
* The string to use to build the read, edit, and delete capabilities.

0 commit comments

Comments
 (0)