Add filter hook `handle_bulk_actions-woocommerce_page_wc-orders` (#35442)
Add filter hook `handle_bulk_actions-woocommerce_page_wc-orders` to the HPOS admin list table. This is a duplicate of core WP hook `handle_bulk_actions-<SCREEN_ID>` and allows for custom bulk actions to be handled in the context of the admin list table for HPOS orders.
This commit is contained in:
parent
c2473da79b
commit
2fcb28b5df
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: add
|
||||
|
||||
Make it possible to add custom bulk action handling to the admin order list screen (when HPOS is enabled).
|
|
@ -941,9 +941,24 @@ class ListTable extends WP_List_Table {
|
|||
if ( isset( $order_statuses[ 'wc-' . $new_status ] ) ) {
|
||||
$changed = $this->do_bulk_action_mark_orders( $ids, $new_status );
|
||||
}
|
||||
} else {
|
||||
$screen = get_current_screen()->id;
|
||||
|
||||
/**
|
||||
* This action is documented in /wp-admin/edit.php (it is a core WordPress hook).
|
||||
*
|
||||
* @since 7.2.0
|
||||
*
|
||||
* @param string $redirect_to The URL to redirect to after processing the bulk actions.
|
||||
* @param string $action The current bulk action.
|
||||
* @param int[] $ids IDs for the orders to be processed.
|
||||
*/
|
||||
$custom_sendback = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $action, $ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||
}
|
||||
|
||||
if ( $changed ) {
|
||||
if ( ! empty( $custom_sendback ) ) {
|
||||
$redirect_to = $custom_sendback;
|
||||
} elseif ( $changed ) {
|
||||
$redirect_to = add_query_arg(
|
||||
array(
|
||||
'bulk_action' => $report_action,
|
||||
|
|
Loading…
Reference in New Issue