Skip to content

Instantly share code, notes, and snippets.

@nosilver4u
Created July 22, 2022 14:49
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 nosilver4u/b52a4773c49c0a79e38d44b2fa1bbca5 to your computer and use it in GitHub Desktop.
Save nosilver4u/b52a4773c49c0a79e38d44b2fa1bbca5 to your computer and use it in GitHub Desktop.
Easy IO Allow AJAX
<?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