Using Theme Constants

On WordPress.com, 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.

So:

  • 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.

Ready to get started?

Tell us about your needs

Let us lead the way. We’ll help you select a top tier development partner. We’ll train your developers, operations, infrastructure, and editorial teams. We’ll coarchitect your deployment processes. We will provide live support for peak events. We’ll help your people avoid dark alleys and blind corners, and reduce wasted cycles.