AdvancedCustomFields / AdvancedCustomFields/acf
update_field, acf_update_value, & acf_update_metadata seems to always return false
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
In my case, update_field always returns false when updating a user_ field. It seems acf_update_value eventually calls acf_update_metadata and it seems to always be false because update_metadata seems to always be false because the eventual $result = $wpdb->update( $table, $data, $where ); always fails, even though the meta appears updated.
When I dump these out:
[$result] => 0
[$table] => wp_usermeta
[$data] => Array
(
[meta_value] => 3
)
[$where] => Array
(
[user_id] => 77
[meta_key] => author_bios
)
It looks like the update here really is just updating the ID of the field? I'm not sure, but this is just updating it to 3 again which really doesn't update the table since it's already set to 3.
So the problem here is I can't rely on update_field to tell me if the DB was actually modified or not for the actual field value I'm trying to change.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the reported path from update_field through acf_update_value and acf_update_metadata into update_metadata and $wpdb->update. Reproduce the user_ field update against wp_usermeta where meta_value is already 3, then verify the intended return value when the stored value remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100