post_type, $post_types, true ) ) { return; } // prevents first past of save_post due to meta boxes on post editor in gutenberg. // phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is used to detect automated saves vs user-initiated saves, not processing form data if ( empty( $_POST ) ) { return; } // ignore revisions. if ( wp_is_post_revision( $post_ID ) ) { return; } // ignore autosaves. if ( wp_is_post_autosave( $post_ID ) ) { return; } // check if update. if ( ! $update ) { return; } // Post in, or going to, trash. if ( 'trash' === $post->post_status ) { // Gutenberg does not fire the `wp_trash_post` action when moving posts to the // trash. Instead, it uses `rest_delete_{$post_type}` which passes a different shape // Instead of hooking in there for every post type supported the data gets purged // here instead which produces the same result. Purge_Post_Data::delete_post( $post_ID ); } } }