1

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.

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?

1 Answer 1

0

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' );
}
2
  • It is possible to remove the metabox and add a custom one.
    – user5424
    Jan 18, 2013 at 18:51
  • @CorvanNoorloos see my update.
    – fuxia
    Jan 18, 2013 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.