Scheduled Posts Count in the Admin Menu
Shows a small counter next to Posts in the admin menu with the number of scheduled posts waiting to go live, so the publishing queue is visible from every screen.
Opens WPIDE on
Code
add_action( 'admin_menu', function () {
global $menu;
$scheduled = (int) wp_count_posts( 'post' )->future;
if ( ! $scheduled ) {
return;
}
foreach ( (array) $menu as $i => $item ) {
if ( isset( $item[2] ) && 'edit.php' === $item[2] ) {
$menu[ $i ][0] .= sprintf(
' <span class="awaiting-mod" style="background:#2271b1" title="Scheduled posts"><span class="pending-count">%d</span><span class="screen-reader-text"> scheduled</span></span>',
$scheduled
);
break;
}
}
}, 99 );
Notes
Uses WordPress's cached post counts, so it adds no extra queries on most screens.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.