rtCamp / nginx-helper

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

Cache post page upon getting published and Preload URLs on shutdown hook #274

Open arafatkn opened 2 years ago

arafatkn commented 2 years ago

Added a new filter named rt_nginx_helper_preload_urls which contains an array of URLs. Those URLs will be preloaded through the shutdown hook.

Get the current updated post from the transition_post_status hook and check whether the post status is published from a non-published status. Then the URL of the post will be added to the rt_nginx_helper_preload_urls filter so that the URL can be preloaded.

With the above process, a new post will be cached as soon as they got published. Also, the rt_nginx_helper_preload_urls filter can also be used to preload other URLs if needed in the future.