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


Loading checkbox values on front-end

    • japel

    • August 30, 2013 at 1:48 am

    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,


    • Elliot

    • August 30, 2013 at 3:01 pm

    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.

    • japel

    • September 2, 2013 at 11:56 pm

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.