Last active
September 16, 2022 10:44
-
-
Save yratof/f9192e20d7c4851cf979 to your computer and use it in GitHub Desktop.
acf load json files and sync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function acf_fields() { | |
// Load field files dynamically | |
$field_files = glob( dirname(__FILE__) .'/acf-fields/*.json' ); | |
foreach ( $field_files as $file ) { | |
if ( apply_filters( 'midsona_allow_acf_file', true, $file ) ) { | |
$json = json_decode( file_get_contents( $file ), true ); | |
$json[0]['local'] = 'json'; | |
// $json[] = | |
acf_add_local_field_group( $json[0] ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment