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.

Source File

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

1 Hook

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?

        public function version($return=false){
            $override = apply_filters('pre_nebula_version', null, $return);
            if ( isset($override) ){return $override;}

            $return = str_replace(array(' ', '_', '-'), '', strtolower($return));

            if ( $return === 'child' && is_child_theme() ){
                return $this->child_version();

            //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'];

            $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'); //Ex:

            preg_match('/(?<primary>(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+[a-z]?))\.?(?<build>\d+)?/i', $nebula_theme_info->get('Version'), $nebula_version);
            $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,
                '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']; //Ex:
                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');