Description
A filter to allow to turn off or modify rules being added to the .htaccess file created for the base upload path. It runs daily during the regeneration of the .htaccess file.
Please consult your system administrator before using this filter.
Usage
The following would apply to all forms.
add_filter('gform_upload_root_htaccess_rules', 'my_filter_function');
Parameters
- $rules Mixed
The Rules of what to parse or not to parse
Examples
Prevent Gravity Forms from adding default rules to the file
This will only stop Gravity Forms from adding the default rules to the .htaccess file created, after the removal of the existing .htaccess file done daily by the cron task gravityforms_cron
add_filter( 'gform_upload_root_htaccess_rules', '__return_false' );
Add new new rules to the .htaccess files
The example below would allow you to add new lines to the .htaccess being regenerated by cron task.
add_filter( 'gform_upload_root_htaccess_rules', function( $rules ) {
$rules[] = 'a new line in the file';
$rules[] = 'another new line';
GFCommon::log_debug( __METHOD__ . '(): .htaccess rules => ' . print_r( $rules, true ) );
return $rules;
} );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in common.php