Send email notification when post type product is publish from pending status
You were close. The hook, you’re trying to use, is called from function wp_transition_post_status(): function wp_transition_post_status( $new_status, $old_status, $post ) { // // … // do_action( “{$new_status}_{$post->post_type}”, $post->ID, $post ); } So, to execute code when product status changes add function to hook publish_product. The first argument passed to the function is $post_id, not WP_Post … Read more