Tag Archives: wordpress snippet

[Snippet] WordPress: Hide Post By Author From Admin Post List

There is a situation where we need to hide a post written by user A from user B while both of them has same role as “Editor”.

Let’s say we have two user as follow:

UserA with ID 17 and roles Editor
UserB with ID 9 and roles Editor

We need to hide all post by UserB so UserA cannot see it in WordPress Post List (admin page).

Code snippet below may help you to do this in easily.

Modified as you want 😀

[Snippet] WordPress: How to use add_meta_box

The add_meta_box() function was introduced in Version 2.5. It allows plugin developers to add meta boxes to the administrative interface.

For example, you want to add a new field for Post such as City. User need to choose City for the post before publish it. We can use add_meta_box to add a new graphical user interface for meta box.


You may add this code snippet in your current active theme functions.php file or create a custom plugin.

Modify the code snippet above as what you need.