Skip to content

Instantly share code, notes, and snippets.

@tokkonopapa
Created November 11, 2018 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokkonopapa/49470fdd3f4f7b9a996c7e8341ccc16e to your computer and use it in GitHub Desktop.
Save tokkonopapa/49470fdd3f4f7b9a996c7e8341ccc16e to your computer and use it in GitHub Desktop.
Give permission to upload any files when administrator uses Elementor Page Builder
<?php
/**
* Drop-in for IP Geo Block custom filters for admin
*
* This file should be named as `drop-in-admin.php`.
*
* @package IP_Geo_Block
* @author tokkonopapa <tokkonopapa@yahoo.com>
* @license GPL-3.0
* @link http://www.ipgeoblock.com/
* @see http://www.ipgeoblock.com/codex/#filter-hooks
* @example Use `IP_Geo_Block::add_filter()` instead of `add_filter()`
*/
class_exists( 'IP_Geo_Block', FALSE ) or die;
/**
* Handle uploaded files when fobidden MIME type is detected.
*
* @param array $validate validation result
* @return array $validate validation result
*/
function my_upload_forbidden( $validate ) {
// Check authority and existence of specific plugin
if ( $validate['auth'] && defined( 'ELEMENTOR_PLUGIN_BASE' ) ) {
unset( $validate['upload'], $validate['result'] );
}
return $validate;
}
IP_Geo_Block::add_filter( "ip-geo-block-upload-forbidden", "my_upload_forbidden" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment