Home Forums Front-end Issues Loading checkbox values on front-end


Loading checkbox values on front-end

  • Dear elliot,

    now I have another question regarding checkbox values.

    I’m saving acf form data with ajax to postmeta, for a checkbox field with two checkboxes and values:

    value, anothervalue

    the data stored by acf for example if both are checked is:


    when I reload the page, retrieving postmeta and
    set $field[‘value’] to a:2{i:0;s:5:”value”;i:1;s:12:”anothervalue”;}

    This is working with normal textfields but the checkboxes are not getting checked 🙁

    If I save the form with the normal acf save function it works.

    what am I doing wrong here? the values on the database side are the same.

    Thank you and best regards,


  • Hi @japel

    Note: Please do not create duplicate posts:

    As written in the previous thread:

    In the database, the value saves as a:2{i:0;s:5:”value”;i:1;s:12:”anothervalue”;}. This is technically a string, but when WP loads the value, it converts it to an array!

    When you update your value, don’t update it with a string, update it with an array.
    The array should contain the values such as “value” and “anothervalue”

    Let me know if you need any extra help.

  • Thank you elliot and sorry for the double-post. I thought you would ignore posts marked as solved, so I recreated one.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Loading checkbox values on front-end’ is closed to new replies.