Title: WP_Theme::parent
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_Theme::parent(): 󠀁[WP_Theme](https://developer.wordpress.org/reference/classes/wp_theme/)󠁿|false

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#wp--skip-link--target)

Returns reference to the parent theme.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#return)󠁿

 [WP_Theme](https://developer.wordpress.org/reference/classes/wp_theme/)|false Parent
theme, or false if the active theme is not a child theme.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#source)󠁿

    ```php
    public function parent() {
    	return isset( $this->parent ) ? $this->parent : false;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-theme.php#L778)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-theme.php#L778-L780)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Theme_JSON_Resolver::get_theme_data()](https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_theme_data/)`wp-includes/class-wp-theme-json-resolver.php` |

Returns the theme’s data.

  | 
| [WP_Theme::get_template_directory()](https://developer.wordpress.org/reference/classes/wp_theme/get_template_directory/)`wp-includes/class-wp-theme.php` |

Returns the absolute path to the directory of a theme’s “template” files.

  | 
| [WP_Theme::get_template_directory_uri()](https://developer.wordpress.org/reference/classes/wp_theme/get_template_directory_uri/)`wp-includes/class-wp-theme.php` |

Returns the URL to the directory of a theme’s “template” files.

  | 
| [WP_Theme::get_files()](https://developer.wordpress.org/reference/classes/wp_theme/get_files/)`wp-includes/class-wp-theme.php` |

Returns files in the theme’s directory.

  | 
| [WP_Theme::__get()](https://developer.wordpress.org/reference/classes/wp_theme/__get/)`wp-includes/class-wp-theme.php` |

__get() magic method for properties formerly returned by [current_theme_info()](https://developer.wordpress.org/reference/functions/current_theme_info/)

  | 
| [WP_Theme::offsetGet()](https://developer.wordpress.org/reference/classes/wp_theme/offsetget/)`wp-includes/class-wp-theme.php` |  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/classes/wp_theme/parent/?output_format=md#comment-content-6239)
 2.   [Bert Van de Poel](https://profiles.wordpress.org/bertvandepoel/)  [  3 years ago  ](https://developer.wordpress.org/reference/classes/wp_theme/parent/#comment-6239)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fparent%2F%23comment-6239)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fparent%2F%23comment-6239)
 4. Beware: this variable is untrimmed. This means that if you look through [wp_get_themes()](https://developer.wordpress.org/reference/functions/wp_get_themes/)
    and do something like `wp_get_theme()->parent() === $theme->get( 'Name' )` that
    it may always return `FALSE` because there’s untrimmed whitespace being returned
    by `parent()`. If you do `trim( wp_get_theme()->parent() ) === $theme->get( 'Name')`
    the result will be as expected.
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fparent%2F%3Freplytocom%3D6239%23feedback-editor-6239)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fparent%2F)
before being able to contribute a note or feedback.