Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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