Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acf/field not returning fields values with Block Binding API #941

Open
maximebj opened this issue Nov 22, 2024 · 0 comments
Open

acf/field not returning fields values with Block Binding API #941

maximebj opened this issue Nov 22, 2024 · 0 comments

Comments

@maximebj
Copy link
Collaborator

Describe the bug
When connecting a block to ACF Fields via the block Binding API, ACF fails to retrieve the value of the field.

To Reproduce
Steps to reproduce the behavior:

  1. Create a group
  2. add a text field
  3. name it my-field for example
  4. activate option "Allow access to value in editor"
  5. activate group field in REST API (not sure if necessary?)
  6. assign group to post type Posts
  7. Create a new post
  8. Add an empty paragraph block
  9. activate code editor in Gutenberg
  10. Add binding manually :
<!-- wp:paragraph {"metadata":{"bindings":{"content":{"source":"acf/field","args":{"key":"my-field"}}}}} -->
<p></p>
<!-- /wp:paragraph -->
  1. Publish post
  2. Consult on frontend

Expected behavior
Value should be displayed. Instead, nothing is shown.

Code
in Bindings.php in get_value() function, line 52 : it seems that get_field_object() always returns false.
I've tried to var_dump() a get_field() with the same $source_attrs['key'] and it works.

Going further, it fails on $store->get( $id )

Capture d’écran 2024-11-22 à 16 13 49

Version Information:

  • WordPress Version 6.7
  • PHP Version 8.3.8
  • ACF Version ACF Free 6.2.8
  • Browser Chrome 131

Additional context
Not sure if I missed something about the configuration

It would be cool to have a proper documentation about block binding on the ACF website. For now, the only reference is on the 6.2.8 release blog post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant