| @@ -211,9 +211,9 @@ | ||
| 211 | 211 | return; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // Update. |
| 215 | - if ( $old_status === 'publish' ) { | |
| 215 | + if ( $new_status === 'publish' && $old_status === 'publish' ) { // @phpstan-ignore-line | |
| 216 | 216 | /** |
| 217 | 217 | * Gutenberg Editor REST API Request |
| 218 | 218 | * - Non-Gutenberg metaboxes are POSTed via a second, separate request to post.php, which appears |
| 219 | 219 | * as an 'update'. Define a meta key that we'll check on the separate request later. |
| @@ -508,8 +508,22 @@ | ||
| 508 | 508 | |
| 509 | 509 | // Display an error. |
| 510 | 510 | if ( is_wp_error( $account_profiles ) ) { |
| 511 | 511 | $this->base->get_class( 'notices' )->add_error_notice( $account_profiles->get_error_message() ); |
| 512 | + | |
| 513 | + // Log the connection error so it's visible in the Logs screen, not just debug.log. | |
| 514 | + if ( $this->base->get_class( 'log' )->is_enabled() ) { | |
| 515 | + $this->base->get_class( 'log' )->add( | |
| 516 | + $post_id, | |
| 517 | + array( | |
| 518 | + 'action' => $action, | |
| 519 | + 'request_sent' => gmdate( 'Y-m-d H:i:s' ), | |
| 520 | + 'result' => 'error', | |
| 521 | + 'result_message' => $account_profiles->get_error_message(), | |
| 522 | + ) | |
| 523 | + ); | |
| 524 | + } | |
| 525 | + | |
| 512 | 526 | continue; |
| 513 | 527 | } |
| 514 | 528 | |
| 515 | 529 | // Merge profiles with existing profiles from other accounts. |