tools/wordpress-post-status-generator
WordPress Post Status Generator
WordPress Post Status Generator is a tool that helps you to generate custom post statuses for your WordPress projects.
snippet.php
function wp_skills_custom_post_status(): void {
$args = array(
'label' => __( 'Draft', 'text-domain' ),
'label_count' => _n_noop( 'Draft (%s)', 'Drafts (%s)', 'text-domain' ),
'public' => true,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'exclude_from_search' => false,
);
register_post_status( 'my_status', $args );
}
// Priority 0 so the status exists before anything queries by it.
add_action( 'init', 'wp_skills_custom_post_status', 0 );
// Note: register_post_status() makes the status usable, but WordPress does not
// add it to the status dropdown in the editor. Doing that needs its own script
// on the edit screen, or a block editor plugin.