How do I directly access a PHP file located in my themes folder?

Assuming you use the correct URL to access the file, everything is being handled in your web server level and WP doesn’t run at all, so WP based solutions like changing rewrite rules will not help you.

It is most likely that there is some web server configuration that sends the 404 for any access to a php file at that folder (guess you should try if other php files there also return 404). You might be able to fix the web server configuration to match your needs, but as @EAMann commented, it is not the right way to write ajax for WP.

Leave a Comment