flush_rewrite_rules
Remove rewrite rules and then recreate rewrite rules.
Description
flush_rewrite_rules( (bool) $hard = true );
Parameters (1)
- 0. $hard — Optional. (bool) =>
true
- Whether to update .htaccess (hard flush) or just update rewrite_rules transient (soft flush). Default is true (hard).
Usage
if ( !function_exists( 'flush_rewrite_rules' ) ) { require_once ABSPATH . WPINC . '/rewrite.php'; } // Whether to update .htaccess (hard flush) or just update // rewrite_rules transient (soft flush). Default is true (hard). $hard = true; // NOTICE! Understand what this does before running. $result = flush_rewrite_rules($hard);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/rewrite.php
- function flush_rewrite_rules( $hard = true ) {
- global $wp_rewrite;
- $wp_rewrite->flush_rules( $hard );
- }