Replies: 1 comment
-
Some interesting areas to experiment would be to utilise Phel router "rooted" into such endpoint to provide neater routing using it's facilities for multiple sub-routes and to leverage it's middleware pattern. Also another and maybe more sophisticated way of adding endpoints beyond Some wrapping would be a nice to have for these use cases might be nice to have in general. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Adding custom
/wp-json/
"REST API" endpoints provides a quick and dirty but already surprisingly functional way to extend WordPress with new interactive functionality leveraging Phel HTML templating and HTMX.241129-phel-plugin-2024-11-30_17.04.39.mp4
Minimal example shown in video with
main.phel
content as follows:API endpoints are public by default but can be restricted based on capabilities by defining
"permission_callback"
function. For WooCommerce admin plugins it would be useful to check e.g. that(php/current_user_can "manage_woocommerce")
. Related resources:See also general WP Rest API docs https://developer.wordpress.org/rest-api/.
Beta Was this translation helpful? Give feedback.
All reactions