Usage
nebula()->is_site_live()
Parameters
This function does not accept any parameters. Is this incorrect?
Examples
<?php if ( is_site_live() ){ //Do something if the site is live } ?>
Additional Notes
This function only works when the Hostnames Nebula option is used. It checks the current hostname to the hostname(s) in Nebula Options to determine if the site is live. It’s useful when development is being done on a different domain/hostname.
Source File
Located in /libs/Utilities/Utilities.php on line 373.
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.
Filters
"pre_is_site_live"Need a new filter hook? Request one here.
Actions
This function has no action hooks available. Request one?Note: This function contains 1 to-do comment.
public function is_site_live(){ $override = apply_filters('pre_is_site_live', null); if ( isset($override) ){return $override;} if ( $this->get_option('hostnames') ){ if ( strpos($this->get_option('hostnames'), $this->url_components('hostname', home_url())) >= 0 ){ //@todo "Nebula" 0: Update strpos() to str_contains() in PHP8 return true; } return false; } return true; }
Override
To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):
add_filter('pre_is_site_live', 'my_custom_is_site_live'); function my_custom_is_site_live(){ //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_is_site_live', '__return_false');