Get parent theme version

In the WP_Theme class, the get method gives you a sanitized theme header. You cannot use it to extract a property. Actually you don’t need to, as you can access it directly like this:

 // get the parent object
 $parent = wp_get_theme()->parent();
 // get parent version
 if (!empty($parent)) $parent_version = $parent->Version;

Leave a Comment