Last active
October 22, 2016 02:18
-
-
Save tokkonopapa/17fde296e7ffe249f4325d551ef7c5e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Example : Validate specific actions of admin-ajax.php at front-end | |
* Use case: Give permission to ajax with specific action at public facing page | |
* | |
* @global array $_GET and $_POST requested queries | |
* @param array $queries array of admin queries which should bypass WP-ZEP. | |
* @return array $queries array of admin queries which should bypass WP-ZEP. | |
*/ | |
function my_bypass_admins( $queries ) { | |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['action'] ) ) { | |
// heartbeat | |
if ( 'heartbeat' === $_POST['action'] ) | |
$queries = array( 'heartbeat' ); | |
// elementor_ | |
elseif ( 0 === strpos( $_POST['action'], 'elementor_' ) ) | |
$queries = array( $_POST['action'] ); | |
} | |
elseif ( 'post.php' === $GLOBALS['pagenow'] && isset( $_GET['action'] ) ) { | |
// edit | |
if ( 'edit' === $_GET['action'] ) | |
$queries = array( 'edit' ); | |
} | |
return $queries; | |
} | |
add_filter( 'ip-geo-block-bypass-admins', 'my_bypass_admins' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment