ACF_Internal_Post_Type::get_raw_posts
Returns an array of raw ACF post data.
Метод класса: ACF_Internal_Post_Type{}
Хуков нет.
Возвращает
Массив.
Использование
$ACF_Internal_Post_Type = new ACF_Internal_Post_Type(); $ACF_Internal_Post_Type->get_raw_posts();
Список изменений
| С версии 6.1 | Введена. |
Код ACF_Internal_Post_Type::get_raw_posts() ACF Internal Post Type::get raw posts ACF 6.4.2
public function get_raw_posts() {
// Try cache.
$cache_key = acf_cache_key( $this->cache_key_plural );
$post_ids = wp_cache_get( $cache_key, 'acf' ); // TODO: Do we need to change the group at all?
if ( $post_ids === false ) {
// Query posts.
$posts = get_posts(
array(
'posts_per_page' => -1,
'post_type' => $this->post_type,
'orderby' => 'menu_order title',
'order' => 'ASC',
'suppress_filters' => false, // Allow WPML to modify the query.
'cache_results' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'post_status' => array( 'publish', 'acf-disabled' ),
)
);
// Update $post_ids with a non-false value.
$post_ids = array();
foreach ( $posts as $post ) {
$post_ids[] = $post->ID;
}
// Update cache.
wp_cache_set( $cache_key, $post_ids, 'acf' );
}
// Loop over ids and populate array of ACF posts.
$return = array();
foreach ( $post_ids as $post_id ) {
$raw_post = $this->get_raw_post( $post_id );
if ( $raw_post ) {
$return[] = $raw_post;
}
}
return $return;
}