Usage
PHP
nebula()->is_background_request()
Parameters
This function does not accept any parameters. Is this incorrect?
Additional Notes
This function is true if the current request is an AJAX, REST, CRON, XMLRPC, or WP installation.
This is great for optimizing server-side functionality that is only meant to be run either during, or not during one of these “background” requests.
Source File
Located in /libs/Utilities/Utilities.php on line 1179.
No Hooks
This function does not have any filters or actions available. Request one?
PHP
public function is_background_request(){ //Check for AJAX (including the WP Heartbeat) if ( $this->is_ajax_request() ){ return true; } //Check for the REST API if ( (defined('REST_REQUEST') && REST_REQUEST) || isset($this->super->get['rest_route']) ){ return true; } //Check if a CRON is running if ( defined('DOING_CRON') && DOING_CRON ){ return true; } //Check if it is an XMLRPC request if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ){ return true; } //Check if WP is installing if ( defined('WP_INSTALLING') && WP_INSTALLING ){ return true; } //If autosaving if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ){ return true; } //CLI if ( defined('WP_CLI') && WP_CLI ){ return true; } return false; }
Override
This function can not be short-circuited with an override filter. Request one?