ActionScheduler_wpCommentLogger::filter_comment_queries │ public │ WC 1.0

Filter comment queries.

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

Хуков нет.

Возвращает

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

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

$ActionScheduler_wpCommentLogger = new ActionScheduler_wpCommentLogger();
$ActionScheduler_wpCommentLogger->filter_comment_queries( $query );
$query(WP_Comment_Query) (обязательный)
Comment query object.

Код ActionScheduler_wpCommentLogger::filter_comment_queries() WC 11.2.2

public function filter_comment_queries( $query ) {
	foreach ( array( 'ID', 'parent', 'post_author', 'post_name', 'post_parent', 'type', 'post_type', 'post_id', 'post_ID' ) as $key ) {
		if ( ! empty( $query->query_vars[ $key ] ) ) {
			return; // don't slow down queries that wouldn't include action_log comments anyway.
		}
	}
	$query->query_vars['action_log_filter'] = true;
	add_filter( 'comments_clauses', array( $this, 'filter_comment_query_clauses' ), 10, 2 );
}