.htaccess to include wp files
-
I’m not sure if what I want to do is even possible, and I’m not a .htaccess guru. Here is my situation.
I have a php file that I wrote as part of my plugin. Let’s say it is called standalone.php. It needs to be accessed from my plugin by sending a request to http://mysite.com/wp-content/plugins/MyPlugin/standalone.php.
However, this does not include any of the wordpress files. I think I need at least “require_once ‘wp-load.php’;” in order to have access to the wordpress functions I need. I have been able to create a recursive function that starts at ../../../../ from the location of standalone.php. However, this is not efficient and could cause problems in the unlikely event that they have multiple versions of wordpress installed on the server or wordpress is installed in a very non-conventional location on the server, both of which are possible.
So I am wondering if anyone knows of a way I can add something to .htaccess to get this to work that way instead. Somebody must have done this before and found a better way to do it than a recursive function that searches the server’s file system for wp-load.php. Any suggestions would be much appreciated.
The topic ‘.htaccess to include wp files’ is closed to new replies.