Skip to Content


Get the version of Nebula. Can return the version number, or commit date of the version.

PHP April 10, 2021




(Optional) (Boolean) What value should be returned.
Default: false

Parameter Notes

Possible $return values include “raw”, “version”, “full”, “date”, “time”, and “utc”.

Leaving it empty or passing false will return an array of all version information.

Note: one additional return value is “realtime” which provides the exact Nebula (parent) version including the real-time build number. Whereas the other return values will pull from wp_get_theme, this will parse the stylesheet directly. This is only available for the parent theme.

Request or provide clarification »


Return the month, day, and year of the Nebula version.

<?php echo nebula()->version('date'); ?>

Additional Notes

Like WordPress, Nebula has a time-based version number. Every May, a major version is released. Likewise, each month a minor version is released. The third number represents the day of the month that Nebula was updated.

Was this page helpful? Yes No

    A feedback message is required to submit this form.

    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Utilities/Utilities.php on line 1394.

    2 Hooks

    Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.

    Need a new filter hook? Request one here.

    This function has no action hooks available. Request one?

    Note: This function contains 1 to-do comment.

            public function version($return=false){
                $override = apply_filters('pre_nebula_version', null, $return);
                if ( isset($override) ){return $override;}
                $appended_version = apply_filters('nebula_version_appended', ''); //Allow others to append an additional version number at the end of Nebula's. This would assist in clearing caches in the parent theme in certain circumstances.
                $appended_version_number = '';
                if ( !empty($appended_version) && substr($appended_version, 0, 1) !== '.' ){ //If it does not start with a dot, add one. //@todo "Nebula" 0: In PHP8 use str_starts_with here
                    $appended_version_number .= '.' . $appended_version;
                $return = str_replace(array(' ', '_', '-'), '', strtolower($return));
                if ( $return === 'child' && is_child_theme() ){
                    return $this->child_version(); //This version gets appended on its own
                //Parse the actual Nebula style.scss file which is closer to real-time than using wp_get_theme() below (which is sufficient for most uses), but is a little more intensive
                if ( $return === 'realtime' ){
                    global $wp_filesystem;
                    $style_scss = $wp_filesystem->get_contents(get_template_directory() . '/assets/scss/style.scss');
                    if ( !empty($style_scss) ){
                        preg_match("/(?:Version: )(?<number>\d+?\.\d+?\.\d+?\.\d+?)$/m", $style_scss, $realtime_version_number);
                        return $realtime_version_number['number']; //Appended version number is not applied to the realtime version
                $nebula_theme_info = ( is_child_theme() )? wp_get_theme(str_replace('-child', '', get_template())) : wp_get_theme(); //Get the parent theme (regardless of if child theme is active)
                if ( $return === 'raw' ){ //Check this first to prevent needing to RegEx altogether
                    return $nebula_theme_info->get('Version') . $appended_version_number; //Ex:
                preg_match('/(?<primary>(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+[a-z]?))\.?(?<build>\d+)?/i', $nebula_theme_info->get('Version'), $nebula_version);
                //If the preg_match fails, exit early here
                if ( empty($nebula_version) ){
                    return 0; //May need to return different types based on what $return value is expected... Trying an int for now.
                $nebula_version['patch'] = preg_replace('/\D/', '', $nebula_version['patch']); //Remove letters from patch number
                $nebula_version_year = ( $nebula_version['minor'] >= 8 )? 2012+$nebula_version['major']+1 : 2012+$nebula_version['major'];
                $nebula_months = array('May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'January', 'February', 'March', 'April');
                $nebula_version_month = $nebula_months[$nebula_version['minor']%12]; //Modulo 12 so the version can go beyond 11 (and still match the appropriate month)
                $nebula_version_day = ( empty($nebula_version['patch']) )? '' : $nebula_version['patch'];
                $nebula_version_day_formated = ( empty($nebula_version['patch']) )? ' ' : ' ' . $nebula_version['patch'] . ', ';
                $nebula_version_info = array(
                    'full' => $nebula_version[0],
                    'primary' => $nebula_version['primary'],
                    'major' => $nebula_version['major'],
                    'minor' => $nebula_version['minor'],
                    'patch' => $nebula_version['patch'],
                    'build' => ( isset($nebula_version['build']) )? $nebula_version['build'] : false,
                    'appended' =>  $appended_version,
                    'utc' => strtotime($nebula_version_month . $nebula_version_day_formated . $nebula_version_year),
                    'date' => $nebula_version_month . $nebula_version_day_formated . $nebula_version_year,
                    'year' => $nebula_version_year,
                    'month' => $nebula_version_month,
                    'day' => $nebula_version_day,
                switch ( $return ){
                    case ('raw'): //Should not ever reach this. See early return above.
                    case ('realtime'): //Probably would not reach this unless Sass is disabled and requesting parent theme realtime version
                        return $nebula_theme_info->get('Version'); //Ex:
                    case ('version'):
                    case ('full'):
                        return $nebula_version_info['full'] . $appended_version; //Ex: (plus any appended number)
                    case ('primary'):
                        return $nebula_version_info['primary']; //Ex: 7.2.23
                    case ('date'):
                        return $nebula_version_info['date']; //Ex: July 23, 2019
                    case ('time'):
                    case ('utc'):
                        return $nebula_version_info['utc']; //Ex: 1559275200
                        return $nebula_version_info;


    To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):

    add_filter('pre_nebula_version', 'my_custom_version', 10, 2); //The last integer must be 1 more than the actual parameters
    function my_custom_version($null, $return){ //$null is required, but can be ignored
        //Write your own code here
        return true; //Return true to prevent the original function from running afterwords

    You can completely disable this PHP function with a single line actions:

     add_filter('pre_nebula_version', '__return_false');