Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save michaelcarwile/8209798 to your computer and use it in GitHub Desktop.
Save michaelcarwile/8209798 to your computer and use it in GitHub Desktop.
Clear wordpress royalslider caches on post save
<?php
//* Add this code to functions.php - ignore opening php tag and this comment.
//* Clear slider caches on new post save - replace num with slider id
function rs_clear_cache() {
delete_transient( 'new-royalslider-posts-1' );
delete_transient( 'new-royalslider-posts-2' );
delete_transient( 'new-royalslider-posts-3' );
delete_transient( 'new-royalslider-posts-4' );
}
add_action( 'save_post', 'rs_clear_cache' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment