ACF_Admin_Internal_Post_Type_List::setup_sync
Sets up the field groups ready for sync.
Метод класса: ACF_Admin_Internal_Post_Type_List{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$ACF_Admin_Internal_Post_Type_List = new ACF_Admin_Internal_Post_Type_List(); $ACF_Admin_Internal_Post_Type_List->setup_sync();
Список изменений
С версии 5.9.0 | Введена. |
Код ACF_Admin_Internal_Post_Type_List::setup_sync() ACF Admin Internal Post Type List::setup sync ACF 6.4.2
public function setup_sync() { // Review local json files. if ( acf_get_local_json_files( $this->post_type ) ) { // Get all posts in a single cached query to check if sync is available. $all_posts = acf_get_internal_post_type_posts( $this->post_type ); foreach ( $all_posts as $post ) { // Extract vars. $local = acf_maybe_get( $post, 'local' ); $modified = acf_maybe_get( $post, 'modified' ); $private = acf_maybe_get( $post, 'private' ); // Ignore if is private. if ( $private ) { continue; // Ignore not local "json". } elseif ( $local !== 'json' ) { continue; // Append to sync if not yet in database. } elseif ( ! $post['ID'] ) { $this->sync[ $post['key'] ] = $post; // Append to sync if "json" modified time is newer than database. } elseif ( $modified && $modified > get_post_modified_time( 'U', true, $post['ID'] ) ) { $this->sync[ $post['key'] ] = $post; } } } }