| @@ -855,10 +855,21 @@ | ||
| 855 | 855 | } else { |
| 856 | 856 | $donor_id = $this->get_donor_id(); |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | - /* Clear out the cache */ | |
| 860 | - wp_cache_delete( $donor_id, 'donors' ); | |
| 859 | + /* | |
| 860 | + * Clear out the cache. | |
| 861 | + * | |
| 862 | + * Only when there is actually an ID. get_donor_id() returns false for a donor who does not | |
| 863 | + * exist yet, which is the normal path into the insert() below - and the `if ( $donor_id )` | |
| 864 | + * immediately after this already accounts for that. Passing false as a cache key trips | |
| 865 | + * WP 6.1+'s "Cache key must be an integer or a non-empty string" _doing_it_wrong notice on | |
| 866 | + * every new-donor save. Deleting the key false was a no-op regardless, so guarding it | |
| 867 | + * changes no behaviour. | |
| 868 | + */ | |
| 869 | + if ( $donor_id ) { | |
| 870 | + wp_cache_delete( $donor_id, 'donors' ); | |
| 871 | + } | |
| 861 | 872 | |
| 862 | 873 | if ( $donor_id ) { |
| 863 | 874 | charitable_get_table( 'donors' )->update( $donor_id, $donor_data ); |
| 864 | 875 | |