| @@ -305,15 +305,12 @@ | ||
| 305 | 305 | */ |
| 306 | 306 | public static function process_status_change( $post_id, $action ) { |
| 307 | 307 | $old_status = get_post_status( $post_id ); |
| 308 | 308 | |
| 309 | - wp_update_post( | |
| 310 | - array( | |
| 311 | - 'ID' => $post_id, | |
| 312 | - 'post_status' => $action, | |
| 313 | - ) | |
| 314 | - ); | |
| 315 | - | |
| 309 | + // Do not wp_update_post() the status here: Action::status() and the order | |
| 310 | + // cascade below both skip their hooks (incl. next-date generation) when | |
| 311 | + // the post_status already equals the target, so this must stay the only | |
| 312 | + // place a real transition happens. | |
| 316 | 313 | if ( $old_status !== $action ) { |
| 317 | 314 | $old_status_object = get_post_status_object( $old_status ); |
| 318 | 315 | $new_status_object = get_post_status_object( $action ); |
| 319 | 316 | WC()->mailer(); |