WordPress at Your Fingertips

flush_rewrite_rules() WP 1.0

Remove rewrite rules and then recreate rewrite rules.

1 time — 0.010174 sec (extremely slow) | 50000 times — 196.39 sec (extremely slow) | PHP 7.1.11, WP 4.9.8

No Hooks.

Return

null. Nothing.

Usage

flush_rewrite_rules( $hard );
$hard(true|false)
Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush).
Default: true (hard)

Notes

  • Global. WP_Rewrite. $wp_rewrite WordPress rewrite component.

Changelog

Since 3.0.0 Introduced.

Code of flush_rewrite_rules() WP 5.8.1

function flush_rewrite_rules( $hard = true ) {
	global $wp_rewrite;

	if ( is_callable( array( $wp_rewrite, 'flush_rules' ) ) ) {
		$wp_rewrite->flush_rules( $hard );
	}
}

Rewrite (clean friendly URL)

No comments
    Log In