The default statues that are included in WordPress are:
The purpose of the post statuses is to provide a publishing workflow to your WordPress site.
If your website needs new post statuses in your workflow that don't match the above then you can use code to create your own post statuses in WordPress by using the function register_post_status().
If your website needs new post statuses in your workflow that don't match the above then you can use code to create your own post statuses in WordPress by using the function register_post_status().
function my_custom_post_status(){
register_post_status( 'unread', array(
'label' => _x( 'Unread', 'post' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Unread <span class="count">(%s)</span>', 'Unread <span class="count">(%s)</span>' ),
) );
}
add_action( 'init', 'my_custom_post_status' );
As you can see there are a number of arguments that the register_post_status takes. The post status generator by Coveloping creates an easy way of setting up your new post status.
The post status generator starts off by offering a number of textbox settings area on the left side of the screen where you can enter all the settings you need to create the post status. First you define what the new post status is called and the function that is used to run the code on creating the new post status. next you can define what the labels are for the post status this will be the text that is shown to the authors when using the post status. The next section allows you to change the display settings for the post status such as if it is used for public posts, can you see this in search results or if this is shown in the admin area.
The settings available are:
This will allow you to quickly create the code like below.
<!--?php // Create new post status function temporary_deleted_post_status( ) { $args = array( 'label' => '_x( 'Temporary Deleted', 'Status name', 'text_domain' )',<br ?--> 'label_count' => _n_noop( 'Temporary Deleted <span class="count">(%s)</span>', 'Temporary Deleted <span class="count">(%s)</span>', 'text_domain' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
);
register_post_status( 'temporary_deleted', $args );
}
add_action( 'init', 'temporary_deleted_post_status');
Try the post status generator now.
Join Coveloping membership from $4.99 a month and get your first month free, cancel at any time
Need help with your website? Hire a coveloping freelancer - fill out our quick form with your requirements and we'll get back to you with an estimate and availabilty. Find out more...