WordPress Custom Post Statuses
WordPress displays post states on post list tables to indicate that a post has a special condition. It’s possible to hook into that list of states and a WordPress custom post status. If you want to make certain posts stand out, or need a custom way to categorize your posts, this is simple way to do it.
The following screenshot illustrates some of the default post states.
Adding a new WordPress Custom Post Status
Adding your own states is actually pretty easy. The following code snippet should get you going in the right direction.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Result of Adding a WordPress Custom Post Status
Assuming you have code elsewhere that is adding the custom field to posts, you’ll see something like this.
If you added code to add a custom field called
_some_custom_field to certain posts, those posts would show up with the ‘Custom State’ status. You could further customize this example to check the value of the custom meta field, and change the post status based on that field.
That’s pretty much it. Obviously there are more useful examples, but this should be enough to get you started.