1. Keep Subscribed Status even After Sent In Stock Email
add_action('transition_post_status', 'cwg_instock_status_update', 10, 3);
function cwg_instock_status_update($new_status, $old_status, $post) {
if ($post && $post->post_type == 'cwginstocknotifier') {
//post type
$post_id = $post->ID;
if ($new_status == 'cwg_mailsent') {
//update the status to subscribe by default
//cwg_subscribed
$instock_post = array(
'ID' => $post_id,
'post_status' => 'cwg_subscribed',
);
wp_update_post($instock_post);
}
}
}