Skip to content

Instantly share code, notes, and snippets.

@benmay
Created January 19, 2013 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benmay/cb906a8d51e7293edde5 to your computer and use it in GitHub Desktop.
Save benmay/cb906a8d51e7293edde5 to your computer and use it in GitHub Desktop.
Flush WordPress rewrite rules when changed
if( get_option( 'custom_pt_rules' ) != md5_file( __FILE__ ) )
{
add_action( 'init', function()
{
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
);
update_option('custom_pt_rules', md5_file( __FILE__ ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment