change page status with code

I figured out how to change the post status and information through code. <?php $my_post = array(‘ID’ => 77, ‘post_title’ => ‘on’,’post_content’ => ‘on’,’post_status’ => ‘draft’,); wp_update_post( $my_post );?> Now I just need to figure out how to make it run when a button is clicked.

Send default WooCommerce email when switching from custom order status

Looks like I was overcomplicating things. This is the solution: add_filter( ‘woocommerce_email_classes’, ‘custom_woocommerce_email_classes’, 10, 1 ); function custom_woocommerce_email_classes( $email_classes ) { $email_classes[ ‘WC_Email_Customer_On_Review_Request’ ] = include_once ‘includes/classes/class-wc-email-customer-on-review-request.php’; // Register custom trigger to send on-hold email when status is switched from on-review to on-hold. add_action( ‘woocommerce_order_status_on-review_to_on-hold_notification’, [ $email_classes[ ‘WC_Email_Customer_On_Hold_Order’ ], ‘trigger’ ], 10, 2 ); return … Read more