Astra_Cache_Base::is_post_autosave_or_revision( int|mixed $post_id )
Check if the given post ID is an autosave or revision.
Description
Parameters
- $post_id
-
(int|mixed) (Required) Post ID to check.
Return
(bool) True if autosave or revision, false otherwise.
Source
File: classes/cache/class-astra-cache-base.php
public function is_post_autosave_or_revision( $post_id ) {
// If not a valid integer post ID, do full cache clear.
if ( null !== $post_id && is_int( $post_id ) && $post_id !== 0 ) {
// Don't clear cache for autosaves or revisions.
if ( wp_is_post_autosave( $post_id ) || wp_is_post_revision( $post_id ) ) {
return true;
}
}
return false;
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.12.2 | Introduced. |