How to Hide Posts Count & Posts From Other Users in Multi-Author Website

How to Hide Posts Count & Posts From Other Users in Multi-Author Website
Like Tweet Pin it Share Share Email

Are you running a multi-author blog? If yes then you may be like to know “How to hide posts count and posts from other Users in a Multi-Author Website”.

Multi-Author blog potential problems/issues

I’m using wordpress latest version and running a multi author blog. When any user (contributor or author) creates his/her account and go to “All posts”,  they were able to:

  1. See All blog posts.
  2. See total post counts
  3. See total published posts
  4. See all pending(admin) approval posts and count
  5. See images of all other users in the media

User Problem: “How can I hide posts of other users, posts count, and all published posts in the post-editor section of a particular user/contributor?

So, I just thought to fix these issues without adding any additional plugin but by adding few lines of code in my child’s theme “function.php” file.

Read: Learn How to Activate Media Button for contributors

Fix 1: How to Hide Posts from “All Posts” area.

Add the following code to your child theme functions.php file and save.

function posts_for_current_author($query) {
    global $user_level;

if($query->is_admin && $user_level < 5) {
    global $user_ID;
    $query->set('author',  $user_ID);
return $query;

add_filter('pre_get_posts', 'posts_for_current_author');

After addition of this code, every individual contributor will not be able to see other people posts under his account. But total post counts and published posts count will still be visible at this point in his account. See below screenshot:

How to Hide Posts Count & Posts From Other Users in Multi-Author Website

Fix 2:  Hide “All” & “Published” section from Users

Add below code to remove a specific All() and Published() post counts from Posts-editor page:

// Create a specific hook
add_filter("views_edit-post", 'custom_editor_counts', 10, 1);

function custom_editor_counts($views) {
    // var_dump($views) to check other array elements that you can hide.
    return $views;

if you want to achieve “more advanced” results like removing All() from Posts-editor admin table and Published() from Pages-editor admin table then use the below code:

add_filter("views_edit-post", 'custom_editor_counts', 10, 1);
function custom_editor_counts($views) {
    $iCurrentUserID = get_current_user_id();
    if ($iCurrentUserID !== 0) {
        global $wpdb;
        foreach ($views as $index => $view) {
            if (in_array($index, array('all', 'publish')))
            $viewValue = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts 
            WHERE post_type='post' AND post_author=$iCurrentUserID AND 
            $views[$index] = preg_replace('/\(.+\)/U', '(' . $viewValue . ')', 
    return $views;

References: [Hide the post count behind Post Views (Remove All, Published and Trashed) in Custom Post Type]

Note that the above code is tested by me on WordPress 4.8 on my blog and is working as it suppose to work. In case you have any issues in using, please let me know in the comments section below and I will be happy to help you.

Other Related Articles: 

How to Get Genesis Framework by Studiopress + FREE Bonus Theme

How To Add Utility Bar In Genesis Child Theme


How to Delete WordPress Post Revisions From Database?

Comments (5)

Leave a Reply

Your email address will not be published. Required fields are marked *

14 − seven =

This site uses Akismet to reduce spam. Learn how your comment data is processed.