ip-location-block-upload-forbidden

Posted on May 11, 2021

This filter hook will be applied when forbidden uploading is detected.

Warning: The filter hook ip-location-block-forbidden-upload was abolished in release 0.3.0.4 , but is replaced to ip-location-block-upload-forbidden.

Description

The filter hook “ip-location-block-upload-forbidden” will be applied via apply_filters() when the request has improper capability or forbidden MIME type is detected in the uploaded files.

Parameters

  • $validation
    (array) An associative array of validation results.
Type Name Description
string ‘ip’ validated ip address
bool ‘auth’ authenticated or not
string ‘code’ country code
string ‘result’ reason of blocking (‘passed’, ‘blocked’)

Use case

The following code snippet can handle the uploaded files.

/**
 * Handle uploaded files when fobidden MIME type is detected.
 *
 * @param  array $validate  validation result
 * @return array $validate  validation result
 */
function my_upload_forbidden( $validate ) {
    // something to handle in $_FILES
    ;

    return $validate;
}
add_filter( "ip-location-block-upload-forbidden", "my_upload_forbidden" );
NOTE: When you select "mu-plugins" (ip-location-block-mu.php) as Validation timing , you should put your code snippet into drop-in.php in Geolocation API folder instead of functions.php. See My custom functions in “functions.php” doesn’t work. in FAQ for detail.

Since

0.3.0.4