WordPress at a glance
function is not described

WP_Rewrite::flush_rules() public WP 2.0.1

Removes rewrite rules and then recreate rewrite rules.

Calls WP_Rewrite::wp_rewrite_rules() after removing the 'rewrite_rules' option. If the function named 'save_mod_rewrite_rules' exists, it will be called.

{} It's a method of the class: WP_Rewrite{}

Hooks from the method
Return

Null. Nothing.

Usage

global $wp_rewrite;
$wp_rewrite->flush_rules( $hard );
$hard(true/false)
Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush).
Default: true (hard)

Changelog

Since 2.0.1 Introduced.

Code of WP_Rewrite::flush_rules() WP 5.5.1

<?php
public function flush_rules( $hard = true ) {
	static $do_hard_later = null;

	// Prevent this action from running before everyone has registered their rewrites.
	if ( ! did_action( 'wp_loaded' ) ) {
		add_action( 'wp_loaded', array( $this, 'flush_rules' ) );
		$do_hard_later = ( isset( $do_hard_later ) ) ? $do_hard_later || $hard : $hard;
		return;
	}

	if ( isset( $do_hard_later ) ) {
		$hard = $do_hard_later;
		unset( $do_hard_later );
	}

	update_option( 'rewrite_rules', '' );
	$this->wp_rewrite_rules();

	/**
	 * Filters whether a "hard" rewrite rule flush should be performed when requested.
	 *
	 * A "hard" flush updates .htaccess (Apache) or web.config (IIS).
	 *
	 * @since 3.7.0
	 *
	 * @param bool $hard Whether to flush rewrite rules "hard". Default true.
	 */
	if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) {
		return;
	}
	if ( function_exists( 'save_mod_rewrite_rules' ) ) {
		save_mod_rewrite_rules();
	}
	if ( function_exists( 'iis7_save_url_rewrite_rules' ) ) {
		iis7_save_url_rewrite_rules();
	}
}