| @@ -701,8 +701,15 @@ | ||
| 701 | 701 | if ( ! is_array( $notice_data ) || empty( $notice_data['message'] ) ) { |
| 702 | 702 | return; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | + // Deduplicate: do not add the same message twice. | |
| 706 | + foreach ( $notices as $existing ) { | |
| 707 | + if ( isset( $existing['message'] ) && $existing['message'] === $notice_data['message'] ) { | |
| 708 | + return; | |
| 709 | + } | |
| 710 | + } | |
| 711 | + | |
| 705 | 712 | $notices[] = $notice_data; |
| 706 | 713 | |
| 707 | 714 | set_site_transient( self::TEMPORARY_NOTICES_TRANSIENT_NAME, $notices, 30 ); |
| 708 | 715 | } |
| @@ -746,8 +753,15 @@ | ||
| 746 | 753 | } |
| 747 | 754 | |
| 748 | 755 | if ( ! is_array( $notice_data ) || empty( $notice_data['message'] ) ) { |
| 749 | 756 | return; |
| 757 | + } | |
| 758 | + | |
| 759 | + // Deduplicate: do not add the same message twice. | |
| 760 | + foreach ( $notices as $existing ) { | |
| 761 | + if ( isset( $existing['message'] ) && $existing['message'] === $notice_data['message'] ) { | |
| 762 | + return; | |
| 763 | + } | |
| 750 | 764 | } |
| 751 | 765 | |
| 752 | 766 | $notices[] = $notice_data; |
| 753 | 767 | |