ActionScheduler_WPCommentCleaner::init()public staticWC 1.0

Initialize the class and attach callbacks.

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

Хуков нет.

Возвращает

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

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

$result = ActionScheduler_WPCommentCleaner::init();

Код ActionScheduler_WPCommentCleaner::init() WC 8.7.0

public static function init() {
	if ( empty( self::$wp_comment_logger ) ) {
		self::$wp_comment_logger = new ActionScheduler_wpCommentLogger();
	}

	add_action( self::$cleanup_hook, array( __CLASS__, 'delete_all_action_comments' ) );

	// While there are orphaned logs left in the comments table, we need to attach the callbacks which filter comment counts.
	add_action( 'pre_get_comments', array( self::$wp_comment_logger, 'filter_comment_queries' ), 10, 1 );
	add_action( 'wp_count_comments', array( self::$wp_comment_logger, 'filter_comment_count' ), 20, 2 ); // run after WC_Comments::wp_count_comments() to make sure we exclude order notes and action logs
	add_action( 'comment_feed_where', array( self::$wp_comment_logger, 'filter_comment_feed' ), 10, 2 );

	// Action Scheduler may be displayed as a Tools screen or WooCommerce > Status administration screen
	add_action( 'load-tools_page_action-scheduler', array( __CLASS__, 'register_admin_notice' ) );
	add_action( 'load-woocommerce_page_wc-status', array( __CLASS__, 'register_admin_notice' ) );
}