I am using W3-Total-Cache plugin, here is my plugin configurations :
I am trying to implement caching on my custom php file. I have created a folder (api) inside plugins directory. i.e /wp-content/plugins/api
. It has a file get_users.php
. It queries the database and returns all the registered users in json format. This is something similar to api where I make an api call to url : http://domain.com/wp-content/plugins/api/get_users.php
It returns data in json format and I am using that data to display in moble app.
The problem I am facing is this url is not caching.
I am not able to see my url in the page_enhanced
folder while other WordPress pages are shown properly.
When I am hitting the url in the browser I am getting the below header response attached in screenshot
My other pages, blog posts, home page are getting cached properly.
I am stuck here from a very long time.
http://domain.com/wp-content/plugins/api/get_users.php
somewhere (which is considered bad practice), this completely bypasses WordPress and thus any caching plugin. I'd suggest leveraging the WordPress REST API instead.