我正在尝试将Wocommerce订单状态存储为自定义表中的“正在处理”,但挂钩不起作用。
add_action( 'woocommerce_order_status_processing', 'action_order_status_processing', 20, 2 );
function action_order_status_processing( $order_id )
{
global $wpdb;
// Get an instance of the WC_Order object (if needed)
$order = wc_get_order( $order_id );
// Your database actions code
$table_name = $wpdb->prefix . 'myExampleTable';
$message = 'Insert to database tutorial.';
$date = date('Y-m-d H:i:s');
$wpdb->insert($table_name, array('content_id' => NULL, 'content_message' => $message,
'content_date' => $date));
}