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

  1. if ( !function_exists( 'flush_rewrite_rules' ) ) { 
  2. require_once ABSPATH . WPINC . '/rewrite.php'; 
  3.  
  4. // Whether to update .htaccess (hard flush) or just update 
  5. // rewrite_rules transient (soft flush). Default is true (hard). 
  6. $hard = true; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = flush_rewrite_rules($hard); 
  10.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/rewrite.php  
  1. function flush_rewrite_rules( $hard = true ) { 
  2. global $wp_rewrite; 
  3. $wp_rewrite->flush_rules( $hard );