WooCommerce中如何根据订单id隐藏单子?[已关闭]

问题描述 投票:0回答:1

如何在订单页面中根据订单id隐藏订单,而不是根据订单状态隐藏订单?

php wordpress woocommerce hook-woocommerce orders
1个回答
1
投票
add_action( 'admin_footer', 'admin_dashboard_subscriptions_filter_callback' );

function admin_dashboard_subscriptions_filter_callback() {
    global $pagenow, $post_type, $post;
    // Targeting subscriptions admin dashboard for specific user role
    $order_ids_to_hide = array( 244, 240 );

    if ( $pagenow === 'edit.php' && $post_type === 'shop_order' && in_array( $post->ID, $order_ids_to_hide ) ) :
    ?>
            <style>
            .post-<?php echo $post->ID; ?> { display: none;}
            </style>
        <?php
    endif;
}
© www.soinside.com 2019 - 2024. All rights reserved.