Skip to content

Instantly share code, notes, and snippets.

@MaximeCulea
Forked from asadowski10/beapi-searchwp.php
Created May 16, 2019 14:11
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 MaximeCulea/47c16d69e3525fc1dbdb9d439e5483a8 to your computer and use it in GitHub Desktop.
Save MaximeCulea/47c16d69e3525fc1dbdb9d439e5483a8 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