Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/flush rewrite rules

Who knows? http://codex.wordpress.org/Function_Reference/WP_Rewrite indicates there's a method called flush_rules, but says nothing about how to use it. Ont he other hand, http://codex.wordpress.org/Custom_Queries refers to a freestanding function with this name, and says it must be used -- sometimes. It appears to have fixed at least one hour-long hairpulling bug of mine, so I thought others might want to find out about it.

Anyway, I don't know what's up. But now at least there's a page in the codex where the answer can be put when someone knows it.

Possible example of use:

/* change author base slug */
add_action( 'init', 'author_base_rewrite' );
function author_base_rewrite() {
	global $wp_rewrite;
	$wp_rewrite->author_base = 'profile';
	flush_rewrite_rules( false );