customization - Custom product status get filtered on all product list views

I registred a new product status with this code :function register_custom_post_status(){register_post_status( 'inva

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.

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.

Share Improve this question asked Jan 22, 2020 at 8:42 ToninoTonino 1
Add a comment  | 

1 Answer 1

Reset to default 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');

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744797404a4594287.html

相关推荐

  • customization - Custom product status get filtered on all product list views

    I registred a new product status with this code :function register_custom_post_status(){register_post_status( 'inva

    2天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信