gregrickaby / nextjs-wordpress

💀 It's headless WordPress!
https://nextjswp.com
MIT License
254 stars 54 forks source link

On-demand Revalidation #24

Closed gregrickaby closed 1 year ago

gregrickaby commented 2 years ago

The on-demand revalidation in the nextjs-wordpress-plugin could use some work. When a user clicks "update" it sends several requests back to Vercel, instead of just 1.

I believe this should be as simple as using wp_transition_post_status() instead of the edit_post hook.

https://developer.wordpress.org/reference/functions/wp_transition_post_status/

https://github.com/gregrickaby/nextjs-wordpress/blob/main/packages/nextjs-wordpress-plugin/inc/revalidation.php#L70

gregrickaby commented 1 year ago

This was fixed, forgot to close.