akamai / wp-akamai

Apache License 2.0
23 stars 16 forks source link

Purge cache on trash #17

Closed pedrammehrdad closed 2 years ago

pedrammehrdad commented 3 years ago

Akamai needs to purge cache upon post deletion and post_save hook is not enough to do that. Because post_save happens after the update and then in the purgeOnPost function we have a condition to not purge if the post is not published. if ( ! is_object( $post ) || $post->post_status != 'publish' ) { return true; } wp_trash_post happens before trashing and it will fix the problem.