WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Plugins» How to Limit Authors to their Own Posts in WordPress Admin

How to Limit Authors to their Own Posts in WordPress Admin

Last updated on April 7th, 2015 by Editorial Staff
37 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Limit Authors to their Own Posts in WordPress Admin

If you run a multi-author site, then you know that the post screen can get a bit crowded. Recently one of our users asked if it was possible to limit the WordPress posts screen to only show authors their own post. In this article, we will show you how to limit authors to only view and manage their own posts in WordPress admin.

Hiding posts from other authors in WordPress

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

First thing you need to do is install and activate the Manage/View Your Posts Only plugin. This plugin works out of the box, and there are no settings for you to configure.

If you are logged in with an administrator user role, then you will be able to see all the posts on your site. Users with other user roles will only be able to see their own posts.

How to Allow Editors to View All Posts

The problem with the plugin mentioned above is that it only allows administrators to view all posts. Many WordPress sites have editors responsible for proof-reading articles submitted by other authors and guest contributors. Using this plugin will restrict editors to only their own posts.

In this situation, the plugin we mentioned above will be useless for you.

Instead, you can add this code in your theme’s functions.php file or a site-specific plugin.

function posts_for_current_author($query) {
	global $pagenow;

	if( 'edit.php' != $pagenow || !$query->is_admin )
	    return $query;

	if( !current_user_can( 'edit_others_posts' ) ) {
		global $user_ID;
		$query->set('author', $user_ID );
	}
	return $query;
}
add_filter('pre_get_posts', 'posts_for_current_author');

This code allows any users with the capability to edit other’s posts to view all posts. This means editors and administrators will be able to see all posts. Users with other roles like contributor or authors will only see their own posts.

If you are using custom user roles on your site, then you need to keep in mind that users who can edit posts added by other users will also be able to see them.

That’s all, we hope this article helped you learn how to hide posts from other authors in WordPress admin area. You may also want to take a look at our tutorial on how to hide unnecessary items from WordPress admin with Adminimize.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Google+.

37 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

24 Comments

Leave a Reply
  1. Ignazio says:
    Mar 24, 2021 at 7:55 am

    You are really great and I congratulate you. If I may, I would like to ask you something. If I wanted to modify this code to make the posts limited in view and edit only to their author as far as drafts are concerned?

    Reply
    • WPBeginner Support says:
      Mar 24, 2021 at 10:45 am

      For what you are wanting, you may want to modify the role permissions or give permissions, you would want to take a look at our article below on permissions:

      https://www.wpbeginner.com/beginners-guide/wordpress-user-roles-and-permissions/

      Reply
  2. Naomi Blindeman says:
    Sep 24, 2020 at 3:32 pm

    Thank you! Lifesaver!

    Reply
    • WPBeginner Support says:
      Sep 25, 2020 at 9:36 am

      You’re welcome :)

      Reply
  3. Dan D says:
    Sep 11, 2020 at 9:15 am

    Exactly what I was looking for. No custom code was needed.

    Reply
    • WPBeginner Support says:
      Sep 11, 2020 at 11:14 am

      Glad our guide was helpful :)

      Reply
  4. Guto Rockwell says:
    Jun 12, 2020 at 9:38 pm

    Works like a charm, many thanks :)

    Reply
    • WPBeginner Support says:
      Jun 15, 2020 at 1:25 pm

      Glad our guide could help :)

      Reply
  5. Zakaria says:
    May 29, 2020 at 11:31 pm

    Your code working perfectly. Thanks!!!

    Reply
    • WPBeginner Support says:
      Jun 1, 2020 at 1:46 pm

      You’re welcome :)

      Reply
  6. Noriel says:
    May 10, 2020 at 11:35 am

    Your recommended plugin is already outdated, any other reliable plugin?

    Reply
    • WPBeginner Support says:
      May 12, 2020 at 9:03 am

      This article was last updated in 2015, we will be sure to look for an alternative and update this article when we are able.

      Reply
  7. Fernando Aureliano says:
    Mar 20, 2019 at 4:03 pm

    It works for all post types?

    Reply
    • WPBeginner Support says:
      Mar 21, 2019 at 11:14 am

      If you’re using the plugin you would need to reach out to the plugin’s support for that specific question.

      Reply
  8. Davood Denavi says:
    Feb 15, 2018 at 1:12 pm

    Does the code mentioned in this article work with all post types? I have some custom post types on a clients site and the plugin worked we do not have time to test the site right now after adding more code and we are trying to allow editors to view all posts.

    Thank in advance for your help!

    Reply
  9. Gulshan Kumar says:
    Jan 9, 2017 at 6:05 am

    How to filter out comments according to currently logged in user?

    I want to restrict listing of all comments for the contributor. I want to allow showing and moderation option only for those posts which belong to them.

    Reply
    • Rohit Mewada says:
      Jan 29, 2018 at 3:39 am

      Same question, how hide comment also from other user.

      Reply
  10. Brandon Evans says:
    Sep 28, 2016 at 6:28 pm

    Does this plugin include hiding of “pages” from non-authors? I see everything listed here says posts but would pages be included in that? Our site uses pages more than posts.

    Reply
  11. Ravijit says:
    Jul 26, 2016 at 7:55 am

    How to hide comments from contributers in wordpress dashboard ???

    Reply
  12. Tom says:
    Apr 25, 2016 at 9:56 am

    Hey there,

    is there a way to exclude specific Post Types from that query ?

    regards Tom

    Reply
  13. Sam says:
    Apr 8, 2016 at 3:34 pm

    What if i have multiple admin and i want admin’s can see only their posts ??

    Reply
  14. barisla says:
    Feb 6, 2016 at 8:47 am

    very useful thanks

    Reply
  15. Charlie says:
    Mar 17, 2015 at 6:32 pm

    Works great. The other problem I have is that it still displays the post count for other users. So for example there are 105 published posts even if the current user only has 2 published posts.

    Any idea how to rectify this?

    Reply
    • Sherwin Ramnarine says:
      Dec 7, 2015 at 8:14 pm

      I realise this is months later so I guess the reply is really for others with the same problem. Try adding this to your functions.php. Think I got it on WordPress.StackExchange.com >>

      // Remove Post Counts

      // 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.
      unset($views[‘all’]);
      unset($views[‘publish’]);
      unset($views[‘pending’]);
      unset($views[‘trash’]);
      return $views;
      }

      Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
PushEngage
PushEngage
Increase your website traffic & revenue with push notifications. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2021 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2021)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2021)
    • SiteGround Reviews from 4464 Users & Our Experts (2021)
    • Bluehost Review from Real Users + Performance Stats (2021)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2021 – Step by Step Guide
Deals & Coupons (view all)
A2 Hosting Coupon Code
A2 Hosting Coupon
Get 66% off A2 Hosting 's premium WordPress hosting.
ChurchThemes.com Coupon
Get 20% OFF on ChurchThemes.com premium WordPress themes and plugin.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).

Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
  • Growth Fund
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon
  • AIOSEO

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress Security by Sucuri.