I have a command line script for maintaining a wordpress plugin and have to determine the wordpress base path to be able to load the wordpress core.
I could just assume the script is several levels under the base path. But if I want to reuse the code and I have another similar script that needs to determine the wordpress base path I would have to adjust the level depth. This is error prone.
edit: ABSPATH
can't be used since it is not defined in the command line script. In fact its value is necessary to be able to load the wordpress core and which will define it.
So how do I determine the wordpress base path when the wordpress environment is not loaded yet?
Similar question: What is the best way to get directory path for wp-config.php?
ABSPATH
? Also, remember to phrase your question in Q&A-style formatABSPATH
is not defined then. I will look into the link you gave me and edit according to it, thanks for this =)