AdvancedCustomFields / AdvancedCustomFields/acf

Does save_post work to update a field in a block?

Open
#649 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

I'm having a problem with save_post and updating an ACF field in a Gutenberg block. I have a field called 'youtube_title' and need to a add some text in a field when a post is being saved. I tried to do the following:

update_field('youtube_title', 'testvbv', $post_id);

The field doesn't get updated when saving. I then added a text box called 'test' and have it shown at the bottom of the editor. When I save a post, text does get added to the field.

update_field('test', 'testvbv', $post_id);

Any idea on how to add text to field inside a Gutenberg block?

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

Start by reviewing the save_post hook and the update_field calls shown in the issue, then compare the youtube_title field's Gutenberg block configuration with the working test field. Done means identifying why the block field is not updated during post save and confirming that youtube_title receives the intended text.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
content
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.