Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Custom JSON callback.
- */
- add_action( 'init', function () {
- // Get URI without query string.
- $uri = strtok( $_SERVER["REQUEST_URI"] , '?' );
- // Check callback path.
- $reg = preg_match( '/\/json-callback\/?$/', $uri, $matches );
- if ( count( $matches ) > 0) {
- // Set header.
- status_header(200);
- // Output JSON of parameters.
- wp_send_json($_GET);
- exit;
- }
- } );
Add Comment
Please, Sign In to add comment