Home › Forums › Backend Issues (wp-admin) › How to check a box when saving a post? › Reply To: How to check a box when saving a post?
It it is a checkbox field then you need to update it with an array of the values you want checked, each value is not stored separately.
$status_active = get_field('status_active', $post_id);
if (!in_array('status_locked', $status_active)) {
$status_active[] = 'status_locked';
update_field('status_active', $status_active, $post_id);
};
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.