WordPress Version: 6.1
/**
* Removes rewrite rules and then recreate rewrite rules.
*
* @since 3.0.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param bool $hard Whether to update .htaccess (hard flush) or just update
* rewrite_rules option (soft flush). Default is true (hard).
*/
function flush_rewrite_rules($hard = true)
{
global $wp_rewrite;
if (is_callable(array($wp_rewrite, 'flush_rules'))) {
$wp_rewrite->flush_rules($hard);
}
}