levi levi - 7 months ago 17
PHP Question

Get 2 levels up from dirname( __FILE__)

How can I return the pathname from the current file, only 2 directories up?

So if I my current file URL is returning

theme/includes/functions.php


How can I return "theme/"

Currently I am using

return dirname(__FILE__)

Answer
return dirname(dirname(__FILE__));

Should return 2 directories up for the current file.