Codex tools: Log in
WordPress allows you to set a workflow status of the content. The status of a post, as set in the Administration Panel, Write Post SubPanel. Internally, these are all stored in the same place, in the wp_posts table. These are differentiated by a column called post_status.
WordPress 3.0 gives you the capability to add your own custom post status and to use it in different ways.
Contents |
There are 8 major post status that WordPress uses by default.
Viewable by everyone.
Scheduled to be published in a future date.
Incomplete post viewable by anyone with proper user level.
Viewable only to WordPress users at Administrator level.
A Custom Status is a Post Status you define.
Adding a custom status to WordPress is done via the register_post_status() function. This function allows you to define the post status and how it operates within WordPress.
Here's a basic example of adding a custom post status called "Unread":
function 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', 'custom_post_status' );