Custom status

I think you can find a lot of good information about status creation in WP. But I didn’t find any notes about how to add a status (custom status, you just created) into inline post edit.

So, I mean this dropdown list:

As you can see, there are only 4 WordPress default common statuses. And when you create your own status with register_post_status() function, it won’t appear there.

function rudr_custom_status_creation(){
	register_post_status( 'featured', array(
		'label'                     => _x( 'Featured', 'post' ), // I used only minimum of parameters
		'label_count'               => _n_noop( 'Featured <span class="count">(%s)</span>', 'Featured <span class="count">(%s)</span>'),
		'public'                    => true
add_action( 'init', 'rudr_custom_status_creation' );

Okay, let’s stop talking and start doing this. I want to show you the code which allows you to add your custom post status into quick edit dropdown.

function rudr_status_into_inline_edit() { // ultra-simple example
	echo "<script>
	jQuery(document).ready( function() {
		jQuery( 'select[name=\"_status\"]' ).append( '<option value=\"featured\">Featured</option>' );

Some comments for the code

  • Insert it to you theme functions.php file. If you know what to do — insert it anywhere you want.
  • For beginners — if your functions.php is empty, first of all add on the first line: <?php.
  • 1-3admin_footer-edit.php action hook means that the code will be processed only on Post wp-admin/edit.php, Pages wp-admin/edit.php?post_type=page and Custom Post Type pages wp-admin/edit.php?post_type={custom post type} in administration area.
  • 6. Is anybody noticed that I didn’t use jQuery each() function? But why? Because quick edit HTML template just one for all posts.

I also recomment you to add the following hook into your functions.php to display the custom post status label like this:

The code:
function rudr_display_status_label( $statuses ) {
	global $post; // we need it to check current post status
	if( get_query_var( 'post_status' ) != 'featured' ){ // not for pages with all posts of this status
		if( $post->post_status == 'featured' ){ // если статус поста - Архив
			return array('Featured'); // returning our status label
	return $statuses; // returning the array with default statuses
add_filter( 'display_post_states', 'rudr_display_status_label' );

That’s it. Please leave comment if you have a question.