Automattic\WooCommerce\Internal\Caches

ProductVersionStringInvalidator::handle_trashed_or_untrashed_postprivateWC 1.0

Handle the trashed_post and untrashed_post hooks.

Метод класса: ProductVersionStringInvalidator{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->handle_trashed_or_untrashed_post( $post_id ): void;
$post_id(int) (обязательный)
The post ID.

Код ProductVersionStringInvalidator::handle_trashed_or_untrashed_post() WC 10.5.2

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 ) {
		$this->invalidate_variation_and_parent( $post_id, $post->post_parent );
	} elseif ( 'product' === $post->post_type ) {
		$this->invalidate( $post_id );
	}
}