Created
May 16, 2019 13:34
-
-
Save asadowski10/35226ae0195176d37f6a88df06774641 to your computer and use it in GitHub Desktop.
Deactive Search WP on AJAX P2P search query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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