Skip to content

Instantly share code, notes, and snippets.

@asadowski10
Created May 16, 2019 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save asadowski10/35226ae0195176d37f6a88df06774641 to your computer and use it in GitHub Desktop.
Save asadowski10/35226ae0195176d37f6a88df06774641 to your computer and use it in GitHub Desktop.
Deactive Search WP on AJAX P2P search query
<?php
/*
Plugin Name: Be API - Search WP
Plugin URI: http://www.beapi.fr
Description: Deactive Search WP on AJAX P2P search query
Author: BeAPI
Author URI: http://www.beapi.fr
Version: 1.0.0
*/
add_filter( 'searchwp_short_circuit', 'beapi_searchwp_short_circuit', 10, 2 );
function beapi_searchwp_short_circuit( $short_circuit, $obj ) {
if ( ! is_admin() ) {
return false;
}
if ( ! DOING_AJAX ) {
return false;
}
if ( ! isset( $_POST['s'] ) ) {
return false;
}
if ( ! isset( $_POST['action'] ) ) {
return false;
}
if ( 'p2p_box' !== $_POST['action'] ) {
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment