0

I registred a new product status with this code :

function register_custom_post_status(){
        register_post_status( 'invalid', array(
            'label'                     => __( 'Not valid', 'xx' ),
            'label_count'               => _n_noop( 'not valid <span class="count">(%s)</span>', 'Not valid <span class="count">(%s)</span>'),
            'public'                    => false,
            'exclude_from_search'       => true,
            'show_in_admin_all_list'    => true,
            'show_in_admin_status_list' => true
        ));
    }

When I set a product on this status ( $product->set_status(‘invalid’); ) the all products list table filter out my product and shows it only in his separate table list. But ‘show_in_admin_all_list’ is set to true, so why happen this? I’m confused.

1 Answer 1

0

I think Below code will slove your problem.I have tested it. /** * Add 'Unread' post status. */ function wpdocs_custom_post_status(){ register_post_status( 'unread', array( 'label' => _x( 'Unread', 'post' ), 'label_count' => _n_noop( 'Unread (%s)', 'Unread (%s)'), 'public' => true, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true )); } add_action( 'init', 'wpdocs_custom_post_status' ); function my_custom_status_add_in_quick_edit() { echo " jQuery(document).ready( function() { jQuery( 'select[name=\"_status\"]' ).append( 'Unread' );
}); "; } add_action('admin_footer-edit.php','my_custom_status_add_in_quick_edit'); function my_custom_status_add_in_post_page() { echo " jQuery(document).ready( function() {
jQuery( 'select[name=\"post_status\"]' ).append( 'Unread' ); }); "; } add_action('admin_footer-post.php', 'my_custom_status_add_in_post_page'); add_action('admin_footer-post-new.php', 'my_custom_status_add_in_post_page');

Your Answer

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

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