Post Status Generator

The default statues that are included in WordPress are:

  • Publish - Posts are visible to everyone.
  • Future - Posts have been scheduled to be published.
  • Draft - Posts are not complete and will only be accessed in the admin area.
  • Pending - Set to be ready for publish by users which do not have publishing rights.
  • Private - Only viewable to admin users
  • Trash - Post has been deleted
  • Auto-Draft - A auto saved revision of the post
  • Inherit - Used by attachments and revisions to take the same status of the parent post.

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().

Create A New 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.

How To Use The Post Status Generator

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.

post-status-generator

The settings available are:

  • Post status - function name used in the code
  • Labels - Label for the post status
  • Display - The visibility of the post status

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' )',
        '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.

Sign up now for your free trial

Join Coveloping membership from $4.99 a month and get your first month free, cancel at any time


Start Now

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...

Code Copied!