I am trying to work out how to add a set of new publish statuses to custom post types in wordpress as I would like to do the following:

User signs in and uses the custom post type to fill in the information fields upon completion the post type should be set to awaiting approval and only viewable but not editable by the user then an admin should be able to set the status of approved (user can then not edit post after this status is set) or set to review required and then the user is able to edit this again once only as it should go back to awaiting approval and lastly rejected that stops the user from editing the post and stays viewable only.

What I need to find out is if its possible to maybe remove or edit the default publish box options to add my own status and how to set the posts to the statuses mentioned above.

Any help or pointing me in the right direction would be great full as i have done a lot of google searching and not found anything that shows me a way to achieve this.


So this is the code below I am trying to get working. I have it set to when a post is changed to publish it should allow me to run the wp_update_post but I'm getting the following error:

Trying to get property of non-object in /Applications/MAMP/htdocs/wordpress/wp-includes/capabilities.php on line 207

 function wpdocs_run_on_publish_only( $new_status, $old_status, $post ) 
    if ( ( 'publish' == $new_status && 'publish' !== $old_status )
        && 'cbre_access_form' == $post->post_type) 
      $my_post = array(
      'ID'           => $post->post_ID,
      'post_title'   => 'This is the post new title.',
      'post_content' => 'This is the new content.',
      'post_status'  => 'awaiting_review',
      wp_update_post( $my_post );
add_action( 'transition_post_status', 'wpdocs_run_on_publish_only', 10, 3 );
  • The edit flow plugin may be able to give you the statuses you want, but a lot of what you're trying to do can already be done via the existing roles, such as contributor, editor, and the pending post status ( if a post that's pending isn't good enough, mark it as a draft )
    – Tom J Nowell
    Nov 19, 2016 at 18:11
  • I will be using role scoper to change the users rights but my aim is to take away parts of the publish box after each status of a post.
    – Sam Miller
    Nov 20, 2016 at 11:35

1 Answer 1


Have you read Custom Status on codex.wordpress.org/Post_Status?

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.

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.

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' );

Although it doesn't look like custom post status is supported in the admin publish metabox but maybe in a future patch.

  • Thanks that code did not work for me I did included it in a plugin I am working on. I have found a plugin called "edit flow" that lets me add custom status. Now I am going to try to and maybe use "transition_post_status" to remove the persons ability to see the publish button.
    – Sam Miller
    Nov 19, 2016 at 18:35
  • When you register, you should see your post status in global $wp_post_statuses; Core just doesn't support showing those custom post stati in the current version. You can read up on why on trac core.trac.wordpress.org/ticket/12706 . Also, a user can be limited based on roles $can_publish = current_user_can($post_type_object->cap->publish_posts); - see codex.wordpress.org/Roles_and_Capabilities
    – jgraup
    Nov 19, 2016 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.