I have a function in functions.php like so:
function myplugin_mycallback($id) {
// do something
}
I want this function called whenever a URL like myplugin/mycallback/xxx is accessed.
How/where do I define this path so it doesn’t generate a 404?
You can use
add_feed( $url, $callback )
. Despite its name it sends atext/html
Content-Type.Basic example:
Visit the permalink settings page once to refresh the rewrite cache, and go to
example.com/wpse50841/
orexample.com/?feed=wpse50841
to see your code in action.