rtCamp / nginx-helper

Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
https://wordpress.org/plugins/nginx-helper/
228 stars 121 forks source link

is &_wpnonce=_________ required to clear page cache? #297

Closed bozzmedia closed 1 year ago

bozzmedia commented 1 year ago

I am trying to make the purge all action more accessible to site editors and was wondering if I simply link to

https://redacted.com/wp-admin/options-general.php?page=nginx&nginx_helper_action=purge&nginx_helper_urls=all

from a dashboard widget, would that clear the cache itself if a user is logged in? If not, is there a way to reference the wpnonce cache clearing url in a custom function outside of the plugin? Thanks for any insight!

Souptik2001 commented 1 year ago

Hi @bozzmedia ,

The _wpnonce query parameter is required for the request to get through check_admin_referer.

If not, is there a way to reference the wpnonce cache clearing url in a custom function outside of the plugin?

Though you can construct the URL with the nonce using the same nonce action used in the plugin. But that's not recommended as any parameter name or anything else might change in future which might break your solution.

So, for your requirement-

Thanks.

bozzmedia commented 1 year ago

Oh perfect, that's exactly what I need. Thanks so much!