AdvancedCustomFields / AdvancedCustomFields/acf

acf/prepare_field Filter not working for clone fields

Open
#774 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hey @mattgrshaw

it seems the acf/prepare_field filter is not working if the field is embedded via clone field. I've tested the filter on a direct implemented field of an ACF block and the result, it's working fine.

But if the ACF block contains a field embedded via clone field, nothing happened:

function my_acf_render_fieldtest( $field ) {
	
	error_log(print_r($field,true));	
	
	return false;
	
}

add_filter('acf/prepare_field/key=field_63971a3eecb6f', 'my_acf_render_fieldtest');

The field is still there and nothing is outputted to $field.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Reproduce the reported acf/prepare_field filter with a direct field and the same field embedded through a clone field in an ACF block, then trace why the cloned field does not invoke the filter. Done means the filter receives the cloned field and returning false removes it as it does for the direct field.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.