Execute `woocommerce_order_action_{$action}` only once

Prevents a “Maximum function nesting level reached” fatal error in
certain cases.

Since this ends up running on `’save_post’`, updating something like
the order status while hooked onto to
`woocommerce_order_action_{$action}` causes a fun recursion :)
This commit is contained in:
Tamara Zuk 2014-11-30 00:14:22 -05:00
parent 23b38f9490
commit f63c5e8c8f
1 changed files with 3 additions and 2 deletions

View File

@ -128,8 +128,9 @@ class WC_Meta_Box_Order_Actions {
} else {
do_action( 'woocommerce_order_action_' . sanitize_title( $action ), $order );
if ( ! did_action( 'woocommerce_order_action_' . sanitize_title( $action ) ) ) {
do_action( 'woocommerce_order_action_' . sanitize_title( $action ), $order );
}
}
}
}