Snippet: Flush Rewrite Rules

Add following snippet to “functions.php” or to your main plugin file.

Snippet

add_action( 'after_switch_theme', my_rewrite_flush' );
function my_rewrite_flush() {
	flush_rewrite_rules();
}

One Response to Snippet: Flush Rewrite Rules

  1. Yeah, nice trick, and thanks to wptuts for linkink your post! :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>