Created
June 14, 2016 19:39
-
-
Save octalmage/1fbc8f2e792d7c3c9365b0fae944e4cf to your computer and use it in GitHub Desktop.
Automatically purge object cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Automatically purge object cache | |
Description: Automatically purge object cache on post changes. | |
*/ | |
foreach ( array( 'trashed_post', 'delete_post', 'edit_post', 'publish_page', 'publish_post', 'save_post' ) as $hook ) { | |
add_action( $hook, 'wp_cache_flush' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment