acf_get_raw_field_groups()
acf_get_raw_field_groups
Returns and array of raw field_group data.
Хуков нет.
Возвращает
Массив
.
Использование
acf_get_raw_field_groups();
Список изменений
С версии 5.7.10 | Введена. |
Код acf_get_raw_field_groups() acf get raw field groups ACF 6.0.4
function acf_get_raw_field_groups() { // Try cache. $cache_key = acf_cache_key( 'acf_get_field_group_posts' ); $post_ids = wp_cache_get( $cache_key, 'acf' ); if ( $post_ids === false ) { // Query posts. $posts = get_posts( array( 'posts_per_page' => -1, 'post_type' => 'acf-field-group', '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 field groups. $field_groups = array(); foreach ( $post_ids as $post_id ) { $field_groups[] = acf_get_raw_field_group( $post_id ); } // Return field groups. return $field_groups; }