ActionScheduler_WPCommentCleaner::init
Initialize the class and attach callbacks.
Method of the class: ActionScheduler_WPCommentCleaner{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = ActionScheduler_WPCommentCleaner::init();
ActionScheduler_WPCommentCleaner::init() ActionScheduler WPCommentCleaner::init code WC 10.4.3
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' ) );
}