WC_Comments::init
Hook in methods.
Method of the class: WC_Comments{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Comments::init();
WC_Comments::init() WC Comments::init code WC 10.6.2
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' ) );
add_filter( 'comment_feed_where', array( __CLASS__, 'exclude_order_comments_from_feed_where' ) );
add_filter( 'akismet_excluded_comment_types', array( __CLASS__, 'akismet_excluded_comment_types' ) );
// 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' ) );
// Secure potential remaining Action Logs.
add_filter( 'comments_clauses', array( __CLASS__, 'exclude_action_log_comments' ), 10, 2 );
add_filter( 'comment_feed_where', array( __CLASS__, 'exclude_action_log_comments_from_feed_where' ) );
// Exclude product reviews from general comments.
add_filter( 'comments_clauses', array( ReviewsUtil::class, 'comments_clauses_without_product_reviews' ), 10, 2 );
// Modifies the moderation URLs in the email notifications for product reviews.
add_filter( 'comment_moderation_text', array( ReviewsUtil::class, 'modify_product_review_moderation_urls' ), 10, 2 );
// Count comments.
add_filter( 'wp_count_comments', array( __CLASS__, 'wp_count_comments' ), 10, 2 );
// Actualize comments count cache whenever there is a new comment or a comment status changes.
add_action( 'wp_insert_comment', array( __CLASS__, 'increment_comments_count_cache_on_wp_insert_comment' ), 10, 2 );
add_action( 'transition_comment_status', array( __CLASS__, 'update_comments_count_cache_on_comment_status_change' ), 10, 3 );
// Count product reviews that pending moderation.
add_action( 'wp_insert_comment', array( __CLASS__, 'maybe_bump_products_reviews_pending_moderation_counter' ), 10, 2 );
add_action( 'transition_comment_status', array( __CLASS__, 'maybe_adjust_products_reviews_pending_moderation_counter' ), 10, 3 );
// 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' ) );
}