How to hide the posts and media of other WordPress users

hide the posts and media of other WordPress users

If you are a WordPress developer or website owner and have worked on a WordPress blog site where many users upload articles, you may have noticed that even though you cannot edit other user’s posts. Inside the WordPress admin, you can still see the titles of all posts.

How to disable showing of posts and media of other WordPress users

By default, WordPress allows authors to see the titles of every published post, draft, and media.

Also Read: Easy Way to Add Custom Fields into WooCommerce Checkout Page

Yes, you may argue that WordPress already includes some roles (such as Administrator, Editor, and so on). and you want the users to be able to only view and edit their own posts, but you don’t want them to be able to view or edit posts or pages created by other users. you can refer to the below screenshot

hide the WordPress posts and media of other users

In this tutorial, we’ll show you all the steps on how to hide the posts and media of other WordPress users

Are you want to get implementation help, or modify or extend the functionality of this script?

A Tutorialswebsite Expert can do it for you.

Before you start, please create a backup of your WordPress site. In case anything goes wrong while you’re tweaking the code.

Step-1: Hide the posts and media of other WordPress users

Open your theme functions.php file and add the below code to hide the posts and media of other WordPress users.

In the WordPress dashboard, the code above will only hide the titles of other user’s posts. As a result, the post counts are still displayed in all posts, drafts, trash, and pending.

To fix the post count in your filter bars as well, we need to follow the next step.

Also Read: Complete Steps to Create Custom Taxonomy in WordPress

Step-2: Fix Posts counts Only Created By Logged In WordPress User

Add the below code snippet to your theme’s functions.php file. Please note that the below code will work only if it is used along with the above-given code.

Using the above code, the post count in your filter bars is resolved but the media counts issue is still pending. So let’s move to the next step to fix the media count issue as well.

Step-2: Fix media counts

Add the below code snippet to your theme’s functions.php file. In order to make this code works, you must also add the first code, which disables the display of other users’ posts and media.

Now after applying this code, you can upgrade the WordPress functionality that allows you to only show the posts and media of the currently logged-in WordPress user.

Are you want to get implementation help, or modify or extend the functionality of this script? Submit a paid service request

Wrapping Words

Well, In this article you will get the complete steps about How to hide the posts and media of other WordPress users. You can extend the functionality as per your requirement. I hope you found this tutorial helpful for your project. Keep learning!

Related posts