ACF View
Please make sure you've the latest plugin version before using these filters.
Some filters are common and available in both versions, but some are available only in our Pro version. They are prefixed as "(Pro)".
Do you want to customize, but some filter is missing? Contact us and we'll add it as soon as possible.
Allows to amend a field value before it's inserted into a field markup.
add_filter('acf_views/view/field_value', function ($fieldValue, $fieldMeta, $viewId) {
// any modifications to the $fieldValue here
return $fieldValue;
}, 10, 3);
$fieldValue
(mixed) Field value$viewId
(int) ID of the current ACF View.
Allows to customize the default field HTML markup.
add_filter('acf_views/view/field_markup', function ($fieldHTML, $fieldMeta, $fieldValue, $viewId) {
// any modifications to the $fieldHTML here
return $fieldHTML;
}, 10, 4);
$fieldHTML
(string) Markup of the field.$fieldValue
(mixed) Field value.$viewId
(int) ID of the current ACF View.
Allows to add custom variables to the custom markup.
add_filter('acf_views/view/custom_variables', function ($phpVariables, $viewId, $objectId, $fieldValues) {
// any modifications to the $phpVariables here
return $phpVariables;
}, 10, 4);
$phpVariables
(array) Current custom variables (Custom Markup Variables field, an associative array of values, where keys are variable names). These variables can be accessed in the custom markup with brackets, like{VARIABLE_NAME}
$viewId
(int) ID of the current ACF View.$objectId
(int) ID of the current data post$fieldValues
(array) An associative field values array, where keys are field identifiers
It’s a built-in WordPress hook that allows modifying the output of the whole shortcode. Code example shown below. Read more here.
add_filter('do_shortcode_tag', function ($output, $tag, $attr) {
if ('acf_views' != $tag) {
return $output;
}
// todo my custom changes for $output
return $output;
}, 10, 3);
Last modified 19d ago