Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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' );
}
share|improve this answer
    
It is possible to remove the metabox and add a custom one. –  Cor van Noorloos Jan 18 '13 at 18:51
    
@CorvanNoorloos see my update. –  toscho Jan 18 '13 at 20:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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