WPSEO_Import_Smartcrawl_SEO::post_find_import()protectedYoast 1.0

Finds all the posts with a certain meta key and imports its values.

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

Хуков нет.

Возвращает

true|false. Import status.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->post_find_import( $key );
$key(строка) (обязательный)
The meta key to search for.

Код WPSEO_Import_Smartcrawl_SEO::post_find_import() Yoast 22.4

protected function post_find_import( $key ) {
	$query_posts = new WP_Query( 'post_type=any&meta_key=' . $key . '&order=ASC&fields=ids&nopaging=true' );

	if ( empty( $query_posts->posts ) ) {
		return false;
	}

	foreach ( array_values( $query_posts->posts ) as $post_id ) {
		$this->import_serialized_post_meta( $post_id, $key );
	}

	return true;
}