Post Status Generator

Overview

Use this tool to create custom code for Post Status with register_post_status() function.

Usage

  • Fill in the user-friendly form.
  • Click the “Update Code” button.
  • Copy the code to your project.
  • Or save it as a snippet and share with the community.

Examples

If you are still learning how to use this tool, check out the following examples:

The function used in the code.
Add Child Themes Support.
Translation file Text Domain. Optional.
Status name used in the code. Up to 32 characters, lowercase.
Post Status singular name. e.g. Draft or Scheduled.
Post Status plural name. e.g. Drafts or Scheduled.
Posts of this status should be shown in the site front end.
Show statuses in the edit listing of the post.
Show statuses list at the top of the edit listings.
e.g. All (12) Custom Status (2)
  Save Snippet
// Register Custom Status
function custom_post_status() {

	$args = array(
		'label'                     => _x( 'Redirect', 'Status General Name', 'text_domain' ),
		'label_count'               => _n_noop( 'Redirect (%s)',  'Redirect (%s)', 'text_domain' ), 
		'public'                    => true,
		'show_in_admin_all_list'    => true,
		'show_in_admin_status_list' => true,
		'exclude_from_search'       => true,
	);
	register_post_status( 'redirect', $args );

}
add_action( 'init', 'custom_post_status', 0 );