WPSEO_Import_Smartcrawl_SEO::post_find_import
Finds all the posts with a certain meta key and imports its values.
Метод класса: WPSEO_Import_Smartcrawl_SEO{}
Хуков нет.
Возвращает
bool. Import status.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->post_find_import( $key );
- $key(строка) (обязательный)
- The meta key to search for.
Код WPSEO_Import_Smartcrawl_SEO::post_find_import() WPSEO Import Smartcrawl SEO::post find import Yoast 28.5
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;
}