WPSEO_Meta_Columns::build_filter_query()protectedYoast 1.0

Uses the vars to create a complete filter query that can later be executed to filter out posts.

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

Хуков нет.

Возвращает

Массив. Array containing the complete filter query.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->build_filter_query( $vars, $filters );
$vars(массив) (обязательный)
Array containing the variables that will be used in the meta query.
$filters(массив) (обязательный)
Array containing the filters that we need to apply in the meta query.

Код WPSEO_Meta_Columns::build_filter_query() Yoast 22.4

protected function build_filter_query( $vars, $filters ) {
	// If no filters were applied, just return everything.
	if ( count( $filters ) === 0 ) {
		return $vars;
	}

	$result               = [ 'meta_query' => [] ];
	$result['meta_query'] = array_merge( $result['meta_query'], [ $this->determine_score_filters( $filters ) ] );

	$current_seo_filter = $this->get_current_seo_filter();

	// This only applies for the SEO score filter because it can because the SEO score can be altered by the no-index option.
	if ( $this->is_valid_filter( $current_seo_filter ) && ! in_array( $current_seo_filter, [ WPSEO_Rank::NO_INDEX, WPSEO_Rank::NO_FOCUS ], true ) ) {
		$result['meta_query'] = array_merge( $result['meta_query'], [ $this->get_meta_robots_query_values() ] );
	}

	return array_merge( $vars, $result );
}