flush_rewrite_rules

The timeline below displays how wordpress function flush_rewrite_rules has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

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);
    }
}

WordPress Version: 5.5

/**
 * Remove 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);
    }
}

WordPress Version: 5.3

/**
 * Remove 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 transient (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);
    }
}

WordPress Version: 5.1

/**
 * Remove rewrite rules and then recreate rewrite rules.
 *
 * @since 3.0.0
 *
 * @global WP_Rewrite $wp_rewrite
 *
 * @param bool $hard Whether to update .htaccess (hard flush) or just update
 *                   rewrite_rules transient (soft flush). Default is true (hard).
 */
function flush_rewrite_rules($hard = true)
{
    global $wp_rewrite;
    $wp_rewrite->flush_rules($hard);
}

WordPress Version: 4.3

/**
 * Remove rewrite rules and then recreate rewrite rules.
 *
 * @since 3.0.0
 *
 * @global WP_Rewrite $wp_rewrite
 *
 * @param bool $hard Whether to update .htaccess (hard flush) or just update
 * 	                 rewrite_rules transient (soft flush). Default is true (hard).
 */
function flush_rewrite_rules($hard = true)
{
    global $wp_rewrite;
    $wp_rewrite->flush_rules($hard);
}

WordPress Version: 3.7

/**
 * Remove rewrite rules and then recreate rewrite rules.
 *
 * @see WP_Rewrite::flush_rules()
 * @since 3.0.0
 *
 * @param bool $hard Whether to update .htaccess (hard flush) or just update
 * 	rewrite_rules transient (soft flush). Default is true (hard).
 */
function flush_rewrite_rules($hard = true)
{
    global $wp_rewrite;
    $wp_rewrite->flush_rules($hard);
}