WP_Theme::parent(): WP_Theme|false

Returns reference to the parent theme.


WP_Theme|false Parent theme, or false if the active theme is not a child theme.

Top ↑


File: wp-includes/class-wp-theme.php. View all references

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

Top ↑


Version Description
3.4.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content

    Beware: this variable is untrimmed. This means that if you look through 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.

You must log in before being able to contribute a note or feedback.