WC_Comments::init()public staticWC 1.0

Hook in methods.

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

Хуков нет.

Возвращает

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

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

$result = WC_Comments::init();

Код WC_Comments::init() WC 8.7.0

public static function init() {
	// Rating posts.
	add_filter( 'comments_open', array( __CLASS__, 'comments_open' ), 10, 2 );
	add_filter( 'preprocess_comment', array( __CLASS__, 'check_comment_rating' ), 0 );
	add_action( 'comment_post', array( __CLASS__, 'add_comment_rating' ), 1 );
	add_action( 'comment_moderation_recipients', array( __CLASS__, 'comment_moderation_recipients' ), 10, 2 );

	// Clear transients.
	add_action( 'wp_update_comment_count', array( __CLASS__, 'clear_transients' ) );

	// Secure order notes.
	add_filter( 'comments_clauses', array( __CLASS__, 'exclude_order_comments' ), 10, 1 );
	add_filter( 'comment_feed_where', array( __CLASS__, 'exclude_order_comments_from_feed_where' ) );

	// Secure webhook comments.
	add_filter( 'comments_clauses', array( __CLASS__, 'exclude_webhook_comments' ), 10, 1 );
	add_filter( 'comment_feed_where', array( __CLASS__, 'exclude_webhook_comments_from_feed_where' ) );

	// Exclude product reviews.
	add_filter( 'comments_clauses', array( ReviewsUtil::class, 'comments_clauses_without_product_reviews' ), 10, 1 );

	// Count comments.
	add_filter( 'wp_count_comments', array( __CLASS__, 'wp_count_comments' ), 10, 2 );

	// Delete comments count cache whenever there is a new comment or a comment status changes.
	add_action( 'wp_insert_comment', array( __CLASS__, 'delete_comments_count_cache' ) );
	add_action( 'wp_set_comment_status', array( __CLASS__, 'delete_comments_count_cache' ) );

	// Support avatars for `review` comment type.
	add_filter( 'get_avatar_comment_types', array( __CLASS__, 'add_avatar_for_review_comment_type' ) );

	// Add Product Reviews filter for `review` comment type.
	add_filter( 'admin_comment_types_dropdown', array( __CLASS__, 'add_review_comment_filter' ) );

	// Review of verified purchase.
	add_action( 'comment_post', array( __CLASS__, 'add_comment_purchase_verification' ) );

	// Set comment type.
	add_action( 'preprocess_comment', array( __CLASS__, 'update_comment_type' ), 1 );

	// Validate product reviews if requires verified owners.
	add_action( 'pre_comment_on_post', array( __CLASS__, 'validate_product_review_verified_owners' ) );
}