At WPBeginner, we typically customize the user roles on our websites. We find that when you only allow users to perform tasks that are necessary for their role, you reduce the chance of errors and improve website security.
Some of our readers have asked if it’s possible to limit authors to see and edit only their own posts on their multi-author WordPress blogs. For privacy reasons, they prefer their contributors not to see other authors’ posts until they are published.
Well, it’s definitely possible, and in this article, we will show you how to easily limit authors to viewing and managing only their own posts in the WordPress dashboard.
Why Limit Authors to Their Own Posts?
By default, your WordPress website will show all posts and pages to all users, regardless of their user role in the admin area. Whether you are an author, editor, contributor, or administrator, you can view all the articles.
This usually isn’t a problem if the authors are part of your company or team.
However, limiting people to viewing their own posts is useful in certain situations. For instance, if you run a multi-author website, then it can be useful to keep authors from seeing other writers’ articles in review.
That being said, let’s take a look at how you can limit authors to view their own posts in the WordPress admin. Here are the topics we will cover in this article:
Limiting Authors to Their Own Posts Using a Plugin
Using a WordPress plugin, you can easily allow authors to see only their own posts without editing code.
For this tutorial, we will be using the PublishPress Permissions plugin. It’s a free plugin that lets you manage WordPress permissions and works out of the box to limit writers to their own articles.
There is also a premium version available in the PublishPress Pro bundle, which offers more permission settings, like who can access the media library. However, you can start with the free version.
First, you’ll need to install and activate the PublishPress Permissions plugin. For more details, you can follow our guide on how to install a WordPress plugin.
Once the plugin is active, it will automatically limit authors and editors so that they see only their own posts in the WordPress admin area.
For example, if you are logged in as the administrator and head over to Posts » All Posts from your dashboard, then you’ll see all the posts.
However, if you log in to the WordPress admin area from an author’s account, then you’ll notice that only the posts created by the author will be visible.
You will not be able to see posts written by other users.
Now, what if you want your editors to be able to access all the posts so they can review them? Let’s see how you can do that.
Allowing Editors to View All Posts
The problem with the above method is that it only allows administrators to view all posts.
Many WordPress sites have editors responsible for proofreading articles submitted by other authors and guest contributors. Using this plugin will restrict editors to only their own posts.
However, you can allow editors to review different authors’ content by using a plugin like PublishPress Capabilities plugin or adding code to your site’s theme files. We will show you both methods.
Using PublishPress Capabilities Plugin
PublishPress Capabilities is another plugin created by PublishPress. For the sake of this tutorial, we will be using the free version. There is also a pro version that you can get when you subscribe to a PublishPress Pro account.
First, you’ll need to install and activate the PublishPress Capabilities plugin on your WordPress website. You can follow our step-by-step guide on how to install a WordPress plugin.
After the plugin is active, go ahead and click on Capabilities in your WordPress admin menu. This will open the ‘Role Capabilities’ page, where you can change permissions for different user roles.
Next, select the user role you want to edit from the dropdown menu in the top left corner.
Once you’ve selected the ‘Editor’ role, you’ll need to make sure that the checkbox for ‘Edit others’ is enabled under the Editing Capabilities settings.
This will allow editors to edit other posts.
After that, scroll down to the Additional Capabilities section and ensure that the ‘list others posts’ checkbox is enabled.
This way, anyone with the editor role will be able to see posts from other authors.
Now, save your settings and view the Posts section on your website by logging in as an editor. If you are able to view and edit other authors’ posts, then it means you’ve correctly set up the settings.
Adding Custom Code to Your Theme
Another way to allow editors to view all posts is by adding custom code to your theme files. However, we don’t recommend this method for beginners as it involves editing code and can break your website.
To start, advanced users can manually add this code to their theme’s functions.php file, but we recommend using a code snippet plugin like WPCode.
Once you have installed and activated the WPCode plugin, you need to head over to the Code Snippets » + Add Snippet page in your WordPress dashboard.
Once there, you should hover your mouse cursor over ‘Add Your Custom Code (New Snippet)’ and then click the ‘+ Add Custom Snippet’ button that appears.
This will open a page where you can add a custom code snippet. First, you should give the snippet a title that describes what the snippet does, such as ‘Allow Editors to View All Posts’.
After that, you need to paste the following code snippet into the Code Preview pane:
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');
Next, make sure you choose the ‘PHP Snippet’ code type from the drop-down menu.
Finally, make sure you toggle the ‘Active’ setting on and then click the ‘Save Snippet’ button to store and activate the code.
This code allows any users with the capability to edit others’ posts to view all posts. This means editors and administrators will be able to see all posts. Users with other roles, like contributors or authors, will only see their own posts.
For more details, you can see our guide on how to add custom code in WordPress without breaking anything.
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 listed in the dashboard.
Bonus: Limiting Authors to View Specific Posts or Pages
You can also limit authors, editors, contributors, and other user roles to view, edit, and delete certain blog posts and pages.
Using the PublishPress Permissions plugin, you can easily decide which specific posts and pages people can view on your website dashboard.
To start, install and activate the PublishPress Permissions plugin on your website. You can refer to our tutorial on how to install a WordPress plugin.
Let’s say you want a specific article to only be edited by the website’s editor and no one else.
To do that, you can edit that post. Once you are in the WordPress block editor, simply scroll down to the ‘Permissions: Edit this Post’ meta box.
Next, you’ll have to click on the dropdown menu for all other user roles and choose the ‘Blocked’ option. By default, the permission will be set to ‘default: Yes’, where everyone can edit the post.
After that, make sure that you leave the setting for the editor to the ‘Enabled’ or ‘default: Yes’ option. When you’ve set the permissions, make sure to update your blog post.
Expert Guides on Changing User Role Capabilities in WordPress
We hope this article helped you learn how to limit authors to their own posts in the WordPress admin area. You may like to see some other articles related to changing the capabilities of WordPress user roles:
- How to Add or Remove Capabilities to User Roles in WordPress
- Beginner’s Guide to WordPress User Roles and Permissions
- Glossary: User Permissions
- How to Let Contributors Edit Their WordPress Posts After Being Approved
- How to Allow Editors to Only Edit Certain Pages in WordPress
- How to Prevent Authors From Deleting Posts in WordPress
- How to Allow Authors to Revise Published Posts in WordPress
- How to Restrict Media Library Access to User’s Own Uploads in WordPress
- How to Allow Blog Users to Moderate Comments in WordPress
- How to Allow Users to Edit Their Comments in WordPress
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Abu-Bakr Sediq
Hello there, I really enjoy this website! I have a question. How to rescrict (limit, Hide) specific options or feature while Author Post New Product or Add News post. To be more clear; How to limit user from some option in “Add New Post” while publishing post. Sorry for my very bad English
WPBeginner Support
If you want to limit the options for a post’s author based on their role, you would want to take a look at our guide below!
https://www.wpbeginner.com/beginners-guide/wordpress-user-roles-and-permissions/
Admin
Lee
Hi there!
Thank you for this great article.
Can I use the Permissions plug in without the Capabilities plug in?
Or does the capabilities plug in work as a ‘base’ for the Permissions one, and they must be used together?
WPBeginner Support
You can use one without the other, they modify different options available to the different user levels.
Admin
lionel
what happens when I remove the plugin? will any changes be removed too and will all users go back to the defaults or will those users require special attention to have PublishPress roles removed? thanks!
WPBeginner Support
If you remove the plugin it would revert the settings from the plugin.
Admin
Eslam Magdy
Thank u so much man!,,, thanks work for me
WPBeginner Support
Glad our article was able to help!
Admin
Ignazio
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?
WPBeginner Support
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/
Admin
Naomi Blindeman
Thank you! Lifesaver!
WPBeginner Support
You’re welcome
Admin
Dan D
Exactly what I was looking for. No custom code was needed.
WPBeginner Support
Glad our guide was helpful
Admin
Guto Rockwell
Works like a charm, many thanks
WPBeginner Support
Glad our guide could help
Admin
Zakaria
Your code working perfectly. Thanks!!!
WPBeginner Support
You’re welcome
Admin
Noriel
Your recommended plugin is already outdated, any other reliable plugin?
WPBeginner Support
This article was last updated in 2015, we will be sure to look for an alternative and update this article when we are able.
Admin
Fernando Aureliano
It works for all post types?
WPBeginner Support
If you’re using the plugin you would need to reach out to the plugin’s support for that specific question.
Admin
Davood Denavi
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!
Gulshan Kumar
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.
Rohit Mewada
Same question, how hide comment also from other user.
Brandon Evans
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.
Ravijit
How to hide comments from contributers in wordpress dashboard ???
Tom
Hey there,
is there a way to exclude specific Post Types from that query ?
regards Tom
Sam
What if i have multiple admin and i want admin’s can see only their posts ??
barisla
very useful thanks
Charlie
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?
Sherwin Ramnarine
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;
}