Automattic\WooCommerce\Internal\Admin\ProductReviews
Reviews::is_review_or_reply()
Determines if the object is a review or a reply to a review.
Метод класса: Reviews{}
Хуки из метода
Возвращает
true|false
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->is_review_or_reply( $object ) : bool;
- $object(WP_Comment|разное) (обязательный)
- Object to check.
Код Reviews::is_review_or_reply() Reviews::is review or reply WC 7.5.1
protected function is_review_or_reply( $object ) : bool { $is_review_or_reply = $object instanceof WP_Comment && in_array( $object->comment_type, [ 'review', 'comment' ], true ) && get_post_type( $object->comment_post_ID ) === 'product'; /** * Filters whether the object is a review or a reply to a review. * * @since 6.7.0 * * @param bool $is_review_or_reply Whether the object in context is a review or a reply to a review. * @param WP_Comment|mixed $object The object in context. */ return (bool) apply_filters( 'woocommerce_product_reviews_is_product_review_or_reply', $is_review_or_reply, $object ); }