Created
July 22, 2022 14:49
-
-
Save nosilver4u/b52a4773c49c0a79e38d44b2fa1bbca5 to your computer and use it in GitHub Desktop.
Easy IO Allow AJAX
This file contains 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
<?php | |
/* | |
Plugin Name: Easy IO Allow AJAX | |
Version: 1.0.0 | |
*/ | |
// Overrides for admin-ajax images. | |
add_filter( 'exactdn_admin_allow_image_downsize', 'easyio_allow_admin_ajax_images', 10, 2 ); | |
add_filter( 'exactdn_admin_allow_image_srcset', 'easyio_allow_admin_ajax_images', 10, 2 ); | |
add_filter( 'exactdn_admin_allow_plugin_url', 'easyio_allow_admin_ajax_images', 10, 2 ); | |
function easyio_allow_admin_ajax_images( $allow, $image ) { | |
if ( ! wp_doing_ajax() ) { | |
return $allow; | |
} | |
// NOTE: replace !insert_ajax_action_here! with your custom AJAX action. | |
if ( ! empty( $_REQUEST['action'] ) && '!insert_ajax_action_here!' === $_REQUEST['action'] ) { | |
return true; | |
} | |
return $allow; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment