Download the PHP package timothyjensen/acf-field-group-values without Composer
On this page you can find all versions of the php package timothyjensen/acf-field-group-values. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timothyjensen/acf-field-group-values
More information about timothyjensen/acf-field-group-values
Files in timothyjensen/acf-field-group-values
Package acf-field-group-values
Short Description Retrieve all post meta and option values for the specified ACF field group
License GPL-3.0+
Informations about the package acf-field-group-values
ACF Field Group Values
This component provides a convenient alternative to ACF's get_field()
function. It can be installed as a WordPress plugin, or required as a dependency (preferred) within your theme or plugin.
Requirements
- PHP 7.3+
Installation
The recommended way to install this component is with Composer:
Alternatively, you can download the latest release and install it like a typical WordPress plugin.
Usage
As of version 2.0.0 the $config
argument must contain all data from the acf field group export. This is a breaking change. Also, you should now pass $config
instead of $config['fields']
. This is especially important when working with clone fields.
-
Configure ACF to save field group JSON files within your theme or plugin. Next, convert the ACF field group JSON to an array that will be passed to the helper function
get_all_custom_field_meta()
: -
Build an array containing all post meta for the specified field group:
-
Build an array containing all option values for the specified field group:
-
Build an array containing all term meta for the specified field group:
-
Build an array containing all user meta for the specified field group:
-
Build a multidimensional array containing all ACF block data for the specified field group:
-
In order to retrieve values for clone fields you must pass a third argument: all field group arrays that contain the fields that will be cloned.
- As of version 3.2 you can include field labels along with values in the results.
Example Results
In the test results below get_all_custom_field_meta()
was 600% faster than get_field()
and required 19 fewer database queries. Note that the returned values are raw meta values as opposed to formatted values that can be returned by get_field()
.