Now I use the init
hook to add my own process for the request, and then check the request should be handled by the plugin, if yes, process and exit, if not do nothing. Like this:
add_action('init',function(){
if(should_intercepte_the_request()){
//process that.
//exit
die("foo");
}else{
//do nothing
}
});
Then you can access the http by: http://localhost
It is recommended that you check the request method, and some access token to make sure the requests are sent by a trusted source.