WPSEO_Import_Platinum_SEO::find_posts_by_robots_meta
Finds posts by a given meta robots value.
Метод класса: WPSEO_Import_Platinum_SEO{}
Хуков нет.
Возвращает
Массив|true|false. Array of Post IDs on success, false on failure.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->find_posts_by_robots_meta( $meta_value );
- $meta_value(строка) (обязательный)
- Robots meta value.
Код WPSEO_Import_Platinum_SEO::find_posts_by_robots_meta() WPSEO Import Platinum SEO::find posts by robots meta Yoast 26.3
protected function find_posts_by_robots_meta( $meta_value ) {
$posts = get_posts(
[
'post_type' => 'any',
'meta_key' => 'robotsmeta',
'meta_value' => $meta_value,
'order' => 'ASC',
'fields' => 'ids',
'nopaging' => true,
]
);
if ( empty( $posts ) ) {
return false;
}
return $posts;
}