Filter hook 'flush_rewrite_rules_hard'

in WP Core File wp-includes/class-wp-rewrite.php at line 1899

View Source

flush_rewrite_rules_hard

Filter Hook
Description
Filters whether a "hard" rewrite rule flush should be performed when requested. A "hard" flush updates .htaccess (Apache) or web.config (IIS).

Hook Information

File Location wp-includes/class-wp-rewrite.php View on GitHub
Hook Type Filter
Line Number 1899

Hook Parameters

Type Name Description
bool $hard Whether to flush rewrite rules "hard". Default true.

Usage Examples

Basic Usage
<?php
// Hook into flush_rewrite_rules_hard
add_filter('flush_rewrite_rules_hard', 'my_custom_filter', 10, 1);

function my_custom_filter($hard) {
    // Your custom filtering logic here
    return $hard;
}

Source Code Context

wp-includes/class-wp-rewrite.php:1899 - How this hook is used in WordPress core
<?php
1894  		 *
1895  		 * @since 3.7.0
1896  		 *
1897  		 * @param bool $hard Whether to flush rewrite rules "hard". Default true.
1898  		 */
1899  		if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) {
1900  			return;
1901  		}
1902  		if ( function_exists( 'save_mod_rewrite_rules' ) ) {
1903  			save_mod_rewrite_rules();
1904  		}

PHP Documentation

<?php
/**
		 * 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.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-rewrite.php
Related Hooks

Related hooks will be displayed here in future updates.