Skip to content

Instantly share code, notes, and snippets.

View daniloparrajr's full-sized avatar
🏃‍♂️
Onward to good things!

Danilo Parra Jr daniloparrajr

🏃‍♂️
Onward to good things!
View GitHub Profile
@daniloparrajr
daniloparrajr / acf-field-group-php-to-json.php
Last active January 23, 2024 05:57 — forked from mishterk/acf-field-group-php-to-json.php
Convert an ACF Field Group from PHP to ACF-JSON
<?php
add_action( 'acf/init', function() {
// Get all the local field groups and loop through them for processing.
$field_groups = acf_get_local_field_groups();
foreach ( $field_groups as $group ) {
// If the field group has fields, load them into the 'fields' key.
if ( acf_have_local_fields( $group['key'] ) ) {
$group_fields = acf_get_local_fields( $group['key'] );