Automattic\WooCommerce\Internal\Caches
ProductVersionStringInvalidator::handle_trashed_or_untrashed_post
Handle the trashed_post and untrashed_post hooks.
Method of the class: ProductVersionStringInvalidator{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->handle_trashed_or_untrashed_post( $post_id ): void;
- $post_id(int) (required)
- The post ID.
ProductVersionStringInvalidator::handle_trashed_or_untrashed_post() ProductVersionStringInvalidator::handle trashed or untrashed post code WC 10.8.1
private function handle_trashed_or_untrashed_post( int $post_id ): void {
$post = get_post( $post_id );
if ( ! $post ) {
return;
}
if ( 'product_variation' === $post->post_type ) {
$parent_id = (int) $post->post_parent;
$this->invalidate_variation_and_parent( $post_id, $parent_id );
$this->invalidate_variations_list( $parent_id );
$this->invalidate_variation_parent_cache( $post_id );
} elseif ( 'product' === $post->post_type ) {
$this->invalidate( $post_id );
$this->invalidate_products_list();
}
}