remove post and categories/tags count from right now dashboard widget

I know it is easily possible to add a post-type count for a custom post type to the right now dashboard widget.

However I wonder if it is also possible to remove stuff from this widget.

Read More

E.g. I don’t have normal posts on my current wordpress site and I don’t need the count to say 0 posts and 0 categories and 0 tags all the time.

Is it possible to remove those counts?

Related posts

Leave a Reply

1 comment

  1. There is no filter in PHP, so we have to use JavaScript:

    add_action( 'admin_footer-index.php', 'wpse_82132_hide_rows' );
    
    function wpse_82132_hide_rows()
    {
        $rows = array (
        #   'posts',
        #   'pages',
            'cats', // meoww!
            'tags',
        #   'comments',
        #   'b_approved',
        #   'b-waiting',
        #   'b-spam',
        );
        $find = '.' . join( ',.', $rows );
        ?>
    <script>
    jQuery( function( $ ) {
        $("#dashboard_right_now").find('<?php echo $find; ?>').parent().addClass('hidden');
    });
    </script>
        <?php
    }
    

    Result

    enter image description here

    To remove the widget completely:

    add_action( 'wp_dashboard_setup', 'wpse_82132_remove_rn_dashboard' );
    
    function wpse_82132_remove_rn_dashboard()
    {
        remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
    }