JSON field for Advanced Custom Fields.
// Get encoded JSON
$json = get_field('json_field');
// Decode JSON to object
$value = json_decode($json);
// Use the values
echo $value->something;
<script type="text/javascript">
window.my_acf_name = <?php echo get_field('json_field') ?>;
</script>
JSON field for Advanced Custom Fields.
This ACF field type is compatible with:
- ACF 5
- Copy the
acf-field-type-json
folder into yourwp-content/plugins
folder - Activate the Advanced Custom Fields: JSON plugin via the plugins admin page
- Create a new field via ACF and select the JSON type
- Please refer to the description for more info regarding the field type settings
composer run-script test
With local setup
composer run-script test:wordpress
Using docker
docker-compose run phpunit
composer install
composer:test:wordpress
Please see readme.txt
for changelog
This ACF field relies heavily on great package https://github.com/josdejong/jsoneditor