John Davidson

Add new custom post status via register_post_status in WordPress


I want to add a custom post status to my blog post.

I have added below code in my functions.php file but I am not able to see that post status in quick edit, in post new page and post edit page. Any advice?

  function my_register_post_status() {
$my_status_args = array(
'label' => __('Activated', 'my'),
'label_count' => __('Activated', 'my'),
'exclude_from_search' => false,
'public' => true,
'publicly_queryable' => true,
'show_in_admin_status_list' => true,
'show_in_admin_all_list' => true,
register_post_status( 'status', $my_status_args );
add_action( 'init', 'my_register_post_status' );

Attached screenshots:

My Answer:
> 'My Custom Status',
> 'public' => true,
> 'exclude_from_search' => false,
> 'show_in_admin_all_list' => true,
> 'show_in_admin_status_list' => true,
> 'label_count' => _n_noop('My Custom Status (%s)', 'My Custom Status (%s)')
> );
> register_post_status('my_custom_status', $my_status_args);
>add_action('init', 'my_register_post_status');

Make sure to check if the post status is registered correctly by checking the database or using a plugin like "Post Statuses" to manage custom post statuses. Also, make sure that the post type you are using supports custom post statuses.

Rate this post

3 of 5 based on 3810 votes


© 2024 - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us