Advertisement
CodeDropz

Filter - Change admin-ajax.php upload URL

Jul 19th, 2024
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1.  add_filter('dnd_cf7_ajax_url', function(){
  2.     return trailingslashit( site_url() ) . '?ajax-dnd-upload=true';
  3.  });
  4.  
  5.  add_action( 'init', function() {
  6.     if ( isset( $_GET['ajax-dnd-upload'] ) && 'true' === $_GET['ajax-dnd-upload'] ) {
  7.         if ( ! empty( $_REQUEST['action'] ) && is_scalar( $_REQUEST['action'] ) ) {
  8.             if ( has_action( 'wp_ajax_' . $_REQUEST['action'] ) ) {
  9.                 do_action( 'wp_ajax_' . $_REQUEST['action'] );
  10.             }
  11.         }
  12.         die('0');
  13.     }
  14.  });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement