Exposing data using a custom WordPress API
You need a die(); before the closing } of the function and you might want to add the relevant php header to tell the browser it’s content-type I wouldn’t worry about the browser returning the wrong content type. As long as your code loading the data treats it as JSON So for your function try … Read more