I used the below code to register my post status and also to select. Everything works fine except the case when it has to display the post status after updating the post, it doesn't show at all. So, could someone give me some pointers for this issue ? You can see in the attached image after updating the post the 'Status:' is empty i would like to have 'Status:Expired'.

// Registering custom post status
   function wpb_custom_post_status(){
   register_post_status('expired', array(
    'label'                     => _x( 'Expired', 'post' ),
    'public'                    => false,
    'exclude_from_search'       => false,
    'show_in_admin_all_list'    => true,
    'show_in_admin_status_list' => true,
    'label_count'               => _n_noop( 'Expired <span class="count">(%s)</span>', 'Expired <span class="count">(%s)</span>' ),
) ); } add_action( 'admin_init', 'wpb_custom_post_status' );

$("select#post_status").append("<option value='expired' selected='selected'>Expired</option>"); });

While publishing

enter image description here

  • The Codex states that registering a post status will not display it in wp-admin, and suggests using the post_submitbox_misc_actions hook instead: codex.wordpress.org/Function_Reference/register_post_status – WebElaine Aug 27 '18 at 13:25
  • This article is exactly what you need; it has an example of using the hook to post_submitbox_misc_actions. It also has some code to add the status to the quick-edit status list if you want. "Add a New Post Status" by JBoullion (jboullion.com/add-new-post-status); he credits the sources for his code too, so everyone gets fair credit. – Tedinoz Aug 29 '18 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.