Skip to content

Instantly share code, notes, and snippets.

@whatnickcodes
Created February 23, 2015 20:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatnickcodes/dd840be8bd96130bc25e to your computer and use it in GitHub Desktop.
Save whatnickcodes/dd840be8bd96130bc25e to your computer and use it in GitHub Desktop.
<?php
add_action('pre_get_posts', function ($query) {
global $wp;
if (!is_admin() && $query->is_main_query()) :
if ($wp->request == '.custom-hidden-endpoint-wordpress-way-is-a-death-trap') {
header('Content-Type: application/json');
echo json_encode(array('hi' => 'mathias'));
exit;
endif;
}
endif;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment