acf_add_local_internal_post_type()
Adds a local ACF internal post type.
Хуков нет.
Возвращает
true|false
.
Использование
acf_add_local_internal_post_type( $post, $post_type );
- $post(массив) (обязательный)
- The main ACF post array.
- $post_type(строка) (обязательный)
- The post type being added.
Список изменений
С версии 6.1 | Введена. |
Код acf_add_local_internal_post_type() acf add local internal post type ACF 6.4.2
function acf_add_local_internal_post_type( $post, $post_type ) { // Apply default properties needed for import. $post = wp_parse_args( $post, array( 'key' => '', 'title' => '', 'local' => 'json', ) ); // Bail early if field group already exists. if ( acf_is_local_internal_post_type( $post['key'], $post_type ) ) { return false; } // Prepare field group for import (adds menu_order and parent properties to fields). $post = acf_prepare_internal_post_type_for_import( $post, $post_type ); // Add to store. acf_get_local_store( '', $post_type )->set( $post['key'], $post ); return true; }