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

in the functions.php of a parent theme, I would like to check for wheter the theme is being run directly, or it is run via a child theme.

Is there a conventional way of doing this? I cant find the is_childtheme() function I would have liked to have found.. so whats the best way? Check for theme name and compare it to parent theme's maybe? how can this be done?

share|improve this question
Now I simply check if get_current_theme() != 'ParentThemeName' – mikkelbreum Apr 15 '11 at 21:34
up vote 5 down vote accepted

As One Trick Pony said, there's a dedicated function (since WP 3.0):


share|improve this answer

WordPress Core does it like this (at least, at one point):

  // We have a child theme active
share|improve this answer
I think it's available in 3.1 as is_child_theme() – onetrickpony Apr 15 '11 at 22:10
Same thing I was going to suggest: compare get_stylesheet_directory_uri() and get_template_directory_uri(). – Chip Bennett Apr 15 '11 at 23:34
I was going to suggest something similar... get_bloginfo( 'template_directory' ) == get_bloginfo( 'stylesheet_directory' ) ... :) +1 – t31os Apr 16 '11 at 8:58

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.