WordPress filter hook · part of WordPress core

wp_doing_cron

A WordPress core filter that 6 plugins also fire themselves, running on 7M+ sites between them.

“Filters whether the current request is a WordPress cron request.”

How to use wp_doing_cron

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'wp_doing_cron', function( $defined ) {
	// Change $defined here.
	return $defined;
}, 10, 1 );

Argument names come from UpdraftPlus: WP Backup & Migration Plugin's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

6 plugins that fire wp_doing_cron

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. UpdraftPlus: WP Backup & Migration Plugin icon UpdraftPlus: WP Backup & Migration Plugin4+ million installs apply_filters( 'wp_doing_cron', defined('DOING_CRON') && DOING_CRON ) includes/class-filesystem-functions.php:629
  2. WPCode icon WPCode3+ million installs apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON ) includes/compat.php:57
  3. WPVulnerability icon WPVulnerability10,000+ installs apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON ) wpvulnerability-compat.php:39
  4. Realbig For WordPress icon Realbig For WordPress700+ installs apply_filters( 'wp_doing_cron', defined('DOING_CRON') && DOING_CRON ) realbigForWP.php:150
  5. WP Optimizer icon WP Optimizer100+ installs apply_filters( 'wp_doing_cron', defined('DOING_CRON') and DOING_CRON ) vendors/wps-framework/environment/wp_polyfill.php:18
  6. Flexy SEO icon Flexy SEOFewer than 10 installs apply_filters( 'wp_doing_cron', defined('DOING_CRON') and DOING_CRON ) vendors/wps-framework/environment/wp_polyfill.php:18

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.