• Resolved jeanius-design

    (@jeanius-design)


    Hi there,

    Strange one. I have updated a standard text field by PHP.

    update_field('field_6634d4aa4f1a8', $dueDate, $clientID);

    It shows on the front end, but the admin area is blank. I can’t seem to get rid of the value on the front end by updating the post in the admin area either. When I try to update it using the front end form, it doesn’t save it.

    The field is selected to save/load in the form settings.

    Am I doing something wrong?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    Where exactly do you use your code?

    update_field('field_6634d4aa4f1a8', $dueDate, $clientID);

    What is the $clientID variable? is it a Post ID, or a User ID? Note that if you want to update a field on a User profile, you have to use the following syntax: user_45. Example:

    update_field('field_6634d4aa4f1a8', $dueDate, 'user_45');

    If you just use a number, ACF will update the field on a post. See ACF documentation.

    Regarding the metadata in the admin that is blank, I would recommend to enable the Developer Mode, it will show you any metadata saved on each Post, Term, Options Pages or User Profiles. This might help you to debug it.

    If you need further assistance, please export your Form in either PHP or Json (using the Export link on the top right corner of your Form UI). So I can try to try to test on my local environment. An export of your Field Group will also help.

    Thanks!

    Regards.

    Thread Starter jeanius-design

    (@jeanius-design)

    Hi Konrad,

    Thanks for the reply. $clientID is a normal post ID, not a user field – so that’s okay.

    How can I send the exported PHP field group and form to you privately, please?

    Thanks.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I would recommend to enable the Developer Mode in order to see which metadata is saved on your post in the admin.

    I’m still not 100% sure to fully understand the issue. When you say “it shows on the front-end”, do you mean get_field() works on the front-end and shows the correct value? or the field is displayed on a front-end form and it has the correct value?

    Also, where do you use that code? In which hook?

    update_field('field_6634d4aa4f1a8', $dueDate, $clientID);

    I’ll need more details, and ideally a screenshot or a video record showing the issue as it’s really vague at the moment.

    I sent you an email from your website, so you can share your Field Group export and ACFE Form export.

    Thanks.

    Regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Mismatched Values’ is closed to new replies.