Documentation Tips & Tricks Using Theme Constants

Using Theme Constants

On, there are a few circumstances where services and plugins will load your theme’s functions.php even if your theme isn’t directly accessed (such as our Post-by-email service, our jobs servers, the wp-api, mobile themes, etc.)

This means constants such as TEMPLATEPATH and STYLESHEETPATH will not be defined or available, and using them in your theme will likely result in fatal errors.


  • Instead of TEMPLATEPATH, use get_template_directory()
  • Instead of STYLESHEETPATH, use get_stylesheet_directory()

Using the above convenient wrapper-functions will ensure your theme works in all possible scenarios where your functions.php file (or any file included by it) attempts to access the parent or child theme directories.

Documentation is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.