LLMS_Comments::__construct()

Constructor.


Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.comments.php

	public function __construct() {

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

		// 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' ) );

		/**
		 * Remove order notes when counting comments on WP versions earlier than 6.0.
		 *
		 * @todo This filter can be safely deprecated once support is dropped for WordPress 6.0.
		 */
		if ( self::should_modify_comment_counts() ) {
			add_filter( 'wp_count_comments', array( __CLASS__, 'wp_count_comments' ), 999, 2 );
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.6.0 Conditionally hook wp_count_comments filter.
3.37.12 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.