Home Forums General Issues Setting True/False positive value en masse


Setting True/False positive value en masse

  • So, I see the True/False field saves values of 1 or 0, and I can set a default value.

    In my case, I am working with a field on Users.

    But, say I want to set the value as 1 across all objects – where these values are not already in the database, do I need to go and save each object manually in order for ACF to do the save?

    Or does the simple act of adding a True/False field to my group with a default value of 1/True go and save the values in bulk for me? That is how I think ACF should help me, but I doubt it does.

    Assuming I’m correct, what is the best way to go setting values in the database en masse? For each user, set field name to 1. Without phpMyAdmin/MySQL. I still haven’t found a nice plugin that would let me manipulate the database easily like that in WordPress.

  • Hi @carllwyman

    Unfortunately, I am afraid that is currently not the case because of how ACF saved the field values.

    ACF saves the field values as post/user meta records. By setting the fields default value, this will auto load the value when editing the user records however, this does not update the records’ meta value.

    As an approach, you would need to loop through updating the values using the update_field method.

    Hope this helps.

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

The topic ‘Setting True/False positive value en masse’ is closed to new replies.