WPSEO_Cornerstone_Filter::filter_posts()publicYoast 1.0

Modify the query based on the seo_filter variable in $_GET.

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

Хуков нет.

Возвращает

Строку. The modified query.

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

$WPSEO_Cornerstone_Filter = new WPSEO_Cornerstone_Filter();
$WPSEO_Cornerstone_Filter->filter_posts( $where );
$where(строка) (обязательный)
Query variables.

Код WPSEO_Cornerstone_Filter::filter_posts() Yoast 23.5

public function filter_posts( $where ) {
	if ( $this->is_filter_active() ) {
		global $wpdb;

		$where .= $wpdb->prepare(
			" AND {$wpdb->posts}.ID IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s AND meta_value = '1' ) ",
			WPSEO_Meta::$meta_prefix . self::META_NAME
		);
	}

	return $where;
}