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

I am trying to code in more consistent manner and would like to know what is the difference between WP: template_directory vs TEMPLATEPATH.

share|improve this question

migrated from stackoverflow.com May 23 '11 at 16:01

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted


template_directory is the URL of the active theme's directory. Before version 2.6 of WordPress it was a local path.

TEMPLATEPATHis also the URL of the active theme's directory.

Before version 2.6 TEMPLATEPATH was used but now it is recommended to use <?php bloginfo('template_directory'); ?>.

Hope this helps!

share|improve this answer
I am using <?php include(TEMPLATEPATH . '/about.txt'); ?> How would I use <?php bloginfo('template_directory'); ?>? – tanktery May 23 '11 at 18:13
Actually, the correct functions to use are get_template_directory_uri() (for the URL to the template, i.e. Parent Theme, directory), and get_stylesheet_directory_uri() (for the URL to the Theme's directory). – Chip Bennett May 23 '11 at 19:33
<a href="<?php echo TEMPLATEPATH; ?>/about.txt">About</a> would be <a href="<?php bloginfo('template_directory'); ?>/about.txt">About</a> – cchiera May 24 '11 at 1:03

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.