| | |
| | | add_action('save_post', [self::class, 'onPostChange'], 10, 2); |
| | | add_action('delete_post', [self::class, 'onPostDelete']); |
| | | |
| | | // Post meta updates |
| | | add_action('updated_post_meta', [self::class, 'onPostMetaChange'], 10, 2); |
| | | add_action('added_post_meta', [self::class, 'onPostMetaChange'], 10, 2); |
| | | add_action('deleted_post_meta', [self::class, 'onPostMetaDelete'], 10, 2); |
| | | // Post meta updates, now handled via Meta.php? |
| | | // add_action('updated_post_meta', [self::class, 'onPostMetaChange'], 10, 2); |
| | | // add_action('added_post_meta', [self::class, 'onPostMetaChange'], 10, 2); |
| | | // add_action('deleted_post_meta', [self::class, 'onPostMetaDelete'], 10, 2); |
| | | |
| | | // Term updates (all taxonomies) |
| | | add_action('edited_term', [self::class, 'onTermChange'], 10, 3); |
| | |
| | | self::invalidateItem('post', $postId); |
| | | } |
| | | |
| | | public static function onPostMetaChange(int $metaId, int $objectId): void |
| | | { |
| | | // error_log('[Clearing cache for post meta change: '.$objectId.']'); |
| | | self::invalidateItem('post', $objectId); |
| | | } |
| | | |
| | | public static function onPostMetaDelete(array $metaIds, int $objectId): void |
| | | { |
| | | // error_log('[Clearing cache for post meta delete: '.$objectId.']'); |
| | | self::invalidateItem('post', $objectId); |
| | | } |
| | | // public static function onPostMetaChange(int $metaId, int $objectId): void |
| | | // { |
| | | //// error_log('[Clearing cache for post meta change: '.$objectId.']'); |
| | | // self::invalidateItem('post', $objectId); |
| | | // } |
| | | // |
| | | // public static function onPostMetaDelete(array $metaIds, int $objectId): void |
| | | // { |
| | | //// error_log('[Clearing cache for post meta delete: '.$objectId.']'); |
| | | // self::invalidateItem('post', $objectId); |
| | | // } |
| | | |
| | | /**************************************************** |
| | | * HOOKS - Terms |
| | | ****************************************************/ |
| | | public static function onTermChange(int $termId, int $ttId, string $taxonomy): void |
| | | { |
| | | // error_log('[Clearing cache for term change: '.$termId.']'); |
| | | error_log('[Clearing cache for term change: '.$termId.']'); |
| | | self::invalidateItem('taxonomy', $termId); |
| | | } |
| | | |