How to Add a Custom Post Status
I couldn’t find any good information about adding custom post statuses in WordPress programmatically, so I decided to publish this tutorial about creating one.
Registering a Custom Post Status Using register_post_status()
First things first, we need to register our custom post status in WordPress. It is kind of similar to how we usually register custom post types and custom taxonomies – we use functions register_post_type() and register_taxonomy() inside the init hook. This time, we will use the register_post_status() function instead.
add_action( 'init', 'rudr_custom_status_creation' );
function rudr_custom_status_creation(){
register_post_status(
'featured',
array(
'label' => 'Featured',
'label_count' => _n_noop( 'Featured <span class="count">(%s)</span>', 'Featured <span class="count">(%s)</span>'),
'public' => true,
)
);
}So, you inserted this code into the functions.php file of your current theme or created a plugin for that, activated it, and… nothing happened.
Don’t get me wrong, the register_post_status() really did something and now we’re able to use our custom post status on our WordPress, but we still need to complete some extra steps in order to make it appear in our admin dashboard.
Show in Admin Status List
Let’s begin with the simplest part, ok?
If you don’t know what an admin status list is, here you go:

As you can see, our custom post status “Featured” is already displayed there. How have I been able to achieve that?
First of all, and it is so obvious – you need to have posts of that custom post status.
But how can we change a post status since we don’t have any admin interface for that yet? I just used the wp_update_post() function for now.
wp_update_post( array(
'ID' => 12345,
'post_status' => 'featured',
) );That should probably be enough, however, let’s take a look at show_in_admin_status_list and show_in_admin_all_list arguments of the register_post_status() function.
register_post_status(
'featured',
array(
'label' => 'Featured',
'show_in_admin_status_list' => true,
'show_in_admin_all_list' => true,By default, in our case, both of them are set to true.
- If you set
show_in_admin_status_listtofalse– your status will disappear from the admin status list, - If you set
show_in_admin_all_listtofalse, posts of your custom status won’t be counted in “All (7)”
That’s pretty much it, let’s continue and add some admin UI.
Add a Custom Post Status to Post Edit Pages
Probably, you won’t be happy after what I am going to show you now, but it is kind of a known WordPress issue, so a patch is this simple jQuery code snippet:
<?php
add_action( 'admin_footer-post.php', function() {
?><script>
jQuery( function( $ ) {
// add our custom post status
$( '#post_status' ).append( '<option value="featured">Featured</option>' )
<?php if( 'featured' === get_post_status() ) : ?>
$( '#post-status-display' ).text( 'Featured' )
$( '#post_status' ).val( 'featured' )
<?php endif; ?>
} )
</script>
<?php
} );Now, our custom post status is added to the WordPress post edit page:

Do we need to do something with the save_post hook as well? No, when you set a custom post status in this dropdown and you registered it properly before, it will be saved without issues.
But this is for the classic editor, what about Gutenberg? Please, let me know in the comments below if you’re interested in the implementation for Gutenberg.
Add a Custom Post Status To the Quick Edit Menu
Our next step – is adding our registered custom post status into the quick edit menu, it usually appears when you click a “Quick Edit” link on the “All posts” page.
Let’s start with a code snippet first which is also based on jQuery:
<?php
add_action( 'admin_footer-edit.php', 'rudr_status_into_inline_edit' );
function rudr_status_into_inline_edit() {
?><script>
jQuery( function($) {
$( 'select[name="_status"]' ).append( '<option value="featured">Featured</option>' );
} );
</script><?php
}Some comments related to the code snippet above:
- Insert it into your theme’s
functions.phpfile. If you already know what you’re doing — insert it wherever you want. - For beginners — if your
functions.phpis empty, first of all, add on the first line:<?php😁 admin_footer-edit.phpaction hook means that the code will be processed only on Postwp-admin/edit.php, Pageswp-admin/edit.php?post_type=pageand Custom Post Type pageswp-admin/edit.php?post_type={custom post type}in the admin area.
And here is our result:

Display a Custom Post Status Label
Last but not least, I also recommend you add the following hook to your functions.php – display_post_states.
add_filter( 'display_post_states', 'rudr_display_status_label' );
function rudr_display_status_label( $states ) {
// skip if we're already filtering by this status
if( 'featured' === get_query_var( 'post_status' ) ) {
return $states;
}
if( 'featured' === get_post_status() ) {
$states[] = 'Featured';
}
return $states;
}It will allow you to display a custom post status label near post titles like this:

Custom Post Statuses in Simple WP Crossposting
Let’s assume that you have added a custom post status to your WordPress website and everything seems to be great, the only thing – you’re using my Simple WP Crossposting plugin and your custom status doesn’t appear in the plugin settings.
By default, my plugin doesn’t support custom post statuses because different plugins can overuse them and I don’t want my plugin settings page to be a complete mess.
That’s why you can include your post status in my plugin with this simple filter hook:
add_filter( 'rudr_swc_post_statuses', function( $post_statuses ) {
$post_statuses[] = 'featured';
return $post_statuses;
} );if you’re not 100% sure, where to use this code, please check this guide.
Here you go:

That’s it. Please leave a comment if you have a question.
Thanks for reading.
Misha Rudrastyh
Hey guys and welcome to my website. For more than 15 years I've been doing my best to share with you some superb WordPress guides and tips for free.
Need some developer help? Contact me
You are missing the part where you select the right value for the new status
Thanks! This is EXACTLY what I was looking for and seems to work for me just fine (not sure about what Jorge’s comment is regarding so maybe I missed something).
Hi,
Three years later – this still seems to be a problem.
I am currently trying to add a custom status (Approved / Rejected) to the Product Post Type created by Woocommerce.
It showed in Posts but not in products. Is this method working with WordPress 4.9.4?
Hi,
Did you try
admin_footeraction hook for a change? I’ve just checked – everything is working for me for WooCommerce products.Thank you so much! It’s really awesome. Really kills my pain
Hi, is there a way to display a green dot on the public page when the status is published and switch to a red dot when the status is a custom one ?
And yes I would really appreciate to know how this could be done :(
I want to display 50 persons who offer services. And when they are unavailable (holiday), i want to change their status easily displaying a green or red dot icon next to the the title/picture in the directory of persons and inside their profile, so inside the post.
Thanks a lot
Hey Fulvio,
Sure, you can do it just with a simple
if-elsestatement:But make sure, that you’re running this code within the loop. If not, you have to pass a post ID variable into the function
get_post_status( $post_id ).Thanks a lot I’ll try it !! :)
that is awesome, thank you so much :)
but when edit a post, I can’t see new status here
do you have any solution?
I think that you will need to a JQuery to add it there.
I havent tried that but see if it works and if you have any problems, let me know.
Jake.
Simply wish to say your article is as amazing. The clarity in your post is simply nice and i could assume you are an expert on this subject. Well with your permission allow me to grab your RSS feed to keep updated with forthcoming post. Thanks a million and please continue the enjoyable work.
Hi Misha,
I’ve come across many of your posts over the years and they have been really helpful. You very often provide a good solution that I can adapt to my situation.
Anyhow, I just wanted to say thank you for taking the time to create them, it’s very much appreciated and I hope you keep at it!
Thank you, Tim!
Thanks Misha for sharing your knowledge.
Regarding your question, yes, it would be really helpful if you could explain how to make it work with Gutenberg.
Also, could it be possible to add statuses to specific post types?
Yes, if you have a tip/an explanation for Gutenberg, it would be great to see.
Currently the publish panel only supports built-in statuses (I think since last April, b/c it now uses the panel from site-editor), and there are even problems with adding a custom post status selector to another select box through the slotfill.
Thank you for the suggestion, I will keep that in mind
I am trying to implement a new status post.
The guide allows you to set all the parameters correctly.
But when saving it saves as public and not as a new status post.
Also it is not listed in the list of post types (all – draft, trash etc)
WP 6.7.2
Fantastic, thank you so much! Sadly, I believe that at this stage there’s no clean way of adding this to Gutenberg, right?
Thank you, that was the best, simple walk through available.
how do we add it to the UI in gutenberg. Please help us.
Also need this for the Block/Gutenberg editor. My issue has been getting the status to show up in the options in the editor. Thanks.