Last active
May 11, 2017 18:09
-
-
Save iandunn/15a5fdaa78d4bfcd2ce29e0453887d7f to your computer and use it in GitHub Desktop.
mu-plugin to test nearby events
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 | |
// type "error" into the city name field to simulate an HTTP request error | |
function nearbywp_trigger_error( $request, $request_args, $request_url ) { | |
$url_params = explode( '&', parse_url( $request_url, PHP_URL_QUERY ) ); | |
if ( in_array( 'location=error', $url_params ) ) { | |
$request = new WP_Error( 'test', 'testing error condition' ); | |
} | |
return $request; | |
} | |
add_filter( 'pre_http_request', 'nearbywp_trigger_error', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment