WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to get a path to the themes directory without the current theme in the path?

ie, in a standard WP install, I would want a reference to:


But the TEMPLATEPATH constant returns...


share|improve this question
up vote 4 down vote accepted

That will return the theme directory.

Never assume /wp-content/ below ABSPATH. I’m using often a different directory and domain for wp-content to enable cookieless requests to theme files. Bad plugins and themes break terribly in such cases.


Or use get_theme_root() for the file path and get_theme_root_uri() for the URI. Both are defined in wp-includes/theme.php.

share|improve this answer
+ 1 Thanks. This works too. Would there be any benefit to using this vs imHavoc's answer? – Scott B Mar 24 '11 at 13:09
@Scott B There should be no difference. STYLESHEETPATH is defined in wp-includes/default-constants.php calling get_stylesheet_directory() which is asking get_theme_root(). – toscho Mar 24 '11 at 13:46
actually, after further review, yours is the more appropriate answer for my question. it returns a file path, not a URL path as get_theme_root_uri() does (c:\ as opposed to http://) and since I'm moving files, that's what I needed in this case. – Scott B Mar 24 '11 at 17:37
@Scott B I added the two functions for for the path and the URI to complete the answer. – toscho Mar 25 '11 at 0:22

There is no THEMEPATH constant, but you can use the get_theme_root_uri() function to retrieve the path to the themes folder.

share|improve this answer
This looks like the best option. Testing it now. – Scott B Mar 24 '11 at 12:42
This works perfectly, however, in this case, I'm looking for a file path, not a URL path. I'm moving files on the server from a plugin folder to the themes folder. Your answer works fine though, depending on the context of the question. – Scott B Mar 24 '11 at 17:40

WP_CONTENT_DIR and WP_CONTENT_URL as well as content_url() get you most of the way there.

share|improve this answer

You can use the constant ABSPATH and just append to it wp-content/themes/ so:

ABSPATH . "wp-content/themes/" 
share|improve this answer
Can the user specify any directory other than wp-content/themes to store their themes? – Scott B Mar 23 '11 at 22:43
@Scott: It is possible but very hard to acomplish and not very likly that anyone has. – Bainternet Mar 23 '11 at 22:51
Two lines in wp-config.php aren’t that hard. ;) Just define WP_CONTENT_DIR and WP_CONTENT_URL. – toscho Mar 23 '11 at 23:13
@toscho: thanks, you learn new stuff every day, i was just reading about it at codex.wordpress.org/Determining_Plugin_and_Content_Directories – Bainternet Mar 23 '11 at 23:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.