Description
The gform_file_upload_whitelisting_disabled filter allows developers to disable file upload whitelisting. This filter applies to all forms.
Usage
The following would apply to all forms.
add_filter( 'gform_file_upload_whitelisting_disabled', '__return_true' );
Parameters
| Parameter | Type | Description |
|---|---|---|
$disabled | bool | Set to true to disable whitelisting. Defaults to false. |
Examples
Disable whitelisting for administrators only.
add_filter( 'gform_file_upload_whitelisting_disabled', function ( $disabled ) {
if ( current_user_can( 'manage_options' ) ) {
return true;
}
return $disabled;
} );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
$whitelisting_disabled = apply_filters( 'gform_file_upload_whitelisting_disabled', false );
This filter is located in includes/upload.php and includes/fields/class-gf-field-fileupload.php.