You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

移除WooCommerce后台订单列表中的特定批量操作

移除WooCommerce订单列表批量操作的解决方案

你需要移除的几个批量操作对应的键名如下,直接添加到现有代码中即可:

  • export_xlsx → Export as XLSX
  • mark_exported → Mark Exported
  • unmark_exported → Unmark Exported
  • duplicate_order → Duplicate

修改后的完整代码:

add_filter( 'bulk_actions-edit-shop_order', 'custom_shop_order_bulk_actions', 999 );
function custom_shop_order_bulk_actions( $actions ) {
    // 移除不需要的批量操作
    unset( 
        $actions['mark_on-hold'], 
        $actions['invoice'],
        $actions['export_xlsx'],
        $actions['mark_exported'],
        $actions['unmark_exported'],
        $actions['duplicate_order']
    );
    return $actions;
}

小提示:如果键名不匹配怎么办?

如果上述键名无效,你可以临时在函数里添加打印语句,查看所有批量操作的实际键名:

add_filter( 'bulk_actions-edit-shop_order', 'custom_shop_order_bulk_actions', 999 );
function custom_shop_order_bulk_actions( $actions ) {
    // 打印所有批量操作键名(使用完记得删除)
    echo '<pre>';
    print_r($actions);
    echo '</pre>';
    
    unset( 
        $actions['mark_on-hold'], 
        $actions['invoice'],
        $actions['export_xlsx'],
        $actions['mark_exported'],
        $actions['unmark_exported'],
        $actions['duplicate_order']
    );
    return $actions;
}

刷新订单列表页面就能看到所有批量操作的键值对,找到对应操作的键名替换即可。

内容的提问来源于stack exchange,提问作者AlexTSF

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 09:12:05