I want to to get the Author name of the Parent theme.

I can get the theme name using wp_get_theme() to get the theme object of the current (child) theme. From this I can get the parent theme name.

Next I think I need to get the object of the parent theme, but unsure how best to approach this. Here is my code so far:

$style_parent_theme = wp_get_theme();
$style_parent_theme_dir = $style_parent_theme->get( 'Template' );
$style_parent_theme_name = wp_get_theme($parent_theme_dir);
$style_parent_theme_author = $style_parent_theme_name->get( 'Author' );

if ($style_parent_theme_author == "WooThemes") {

Thanks for all the help which pointed me in the right direction. In the end I used the following:

$style_parent_theme = wp_get_theme(get_template());
$style_parent_theme_author = $style_parent_theme->get( 'Author' );

I use get_template() to recover the folder name of the parent theme.

wp_get_theme then get's the theme object.

Once we have that we can manipulate the object to get the author name.

  • 1
    You can make it one liner too: $style_parent_theme_author = wp_get_theme( get_template() )->get( 'Author' ); – Frank P. Walentynowicz Jun 3 '15 at 14:44

I was searching for getting the name of the parent theme and stumbled over this post.

I think the best solution is not mentioned here:

wp_get_theme()->parent()->get( 'Author' );

or what I needed:

wp_get_theme()->parent()->get( 'Name' )

Line 3 of your code reads:

$style_parent_theme_name = wp_get_theme($parent_theme_dir);

it should be:

$style_parent_theme_name = wp_get_theme($style_parent_theme_dir);

otherwise the code is correct.

  • Note: two variable names do not reflect their real meaning: $style_parent_theme better be $style_current_theme and $style_parent_theme_name better be $style_parent_theme – Frank P. Walentynowicz Jun 3 '15 at 6:05

You can get this value about the child theme. At first get your child theme date. The simplest way is the function wp_get_theme(), see codex for the parameters and more information. You get a object with all relevant information about the current theme. In step two check, if is a child theme and then get his parent information, like the follow source.

// Current WP_Theme object.
// Get this data via hook or class WP_Theme
// As wrapper, simple to sue is the function wp_get_theme()
$theme_data    = wp_get_theme();
$is_child      = $this->is_child( $theme_data );

if ( $is_child ) {
    $parent_name = $theme_data->parent()->Name;

The method is_child is simple:

function is_child( $theme_data ) {
    // For limitation of empty() write in var
    $parent = $theme_data->parent();
    if ( ! empty( $parent ) ) {
        return TRUE;
    return FALSE;

This works for me.

  $my_theme = wp_get_theme('parentThemeName');
  echo $my_theme->get( 'Author' );
  • It does not explain why his code returns incorrect author of parent's theme. – Frank P. Walentynowicz Jun 3 '15 at 5:42

simple function

function show_theme_author(){

    $theme = wp_get_theme();

    return $theme->get('Author');

  • this shows the version - the question was about getting the author name – raison Sep 26 '16 at 9:34
  • 1
    @raison pasted wrong function , fixed – Benn Sep 26 '16 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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