DOING_AUTOSAVE function in wordpress

That conditional logic first checkes if the constant DOING_AUTOSAVE is defined by using the PHP function defined('SOME_CONSTANT_NAME').

Then the logic checks to see if the state/value of the constant DOING_AUTOSAVE is true, that’s the second part of the conditional right after the && (and).

So if DOING_AUTOSAVE has been defined in the request lifecycle and the state/value of DOING_AUTOSAVE is true then we return which is a means of aborting the logic that is to follow beneath the conditional.

DOING_AUTOSAVE only gets defined and set as true in the wp-admin/includes/post.php file within the wp_autosave() function.

Of course it may be defined elsewhere customly…

Leave a Comment