Languages: English • 日本語 (Add your language)
Register a post status.
A simple function for creating or modifying a post status based on the parameters given. The function will accept two parameters; a string for the post status name and an array of arguments.
This function should not be called before the 'init' action.
NOTICE:
This function does NOT add the registered post status to the admin panel. This functionality is pending future development. Please refer to Trac Ticket #12706.
Consider the action hook post_submitbox_misc_actions for adding this parameter.
<?php register_post_status( $post_status, $args ); ?>
Note: If the 'public','internal','protected', and 'private' parameters are not explicitly set (null), then 'internal' will default to true.
Note: Defaults to bool of 'internal' parameter.
Note: Defaults to opposite bool of 'internal' parameter.
Note: Defaults to opposite bool of 'internal' parameter.
An example of registering a post status called "Unread":
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' );
register_post_status() is located in wp-includes/post.php