Let say I've a custom page with slug created "/products", I want user will be able to POST to a form with url "/products/create" and allow us to render some JSON output.
The "/products/create" page does not actually exist.
I see from , the basic approach are
- Add a rewrite if match my target url, add a custom query var, e.g. is_my_action=1
- Register the custom query var (is_my_action) via "query_vars" action hook
- In the parse_request hook check for this query var, and perform my works.
This approach work, but seems a little hackish, are there any potential issue with the above approach?
Are there any better way to add custom virtual url that ?