Hello,
Here I use the plugin “advancedcustomfields”. I create a group of checkbox that appears perfectly. However I can not save the values of checkboxes in the admin part of wordpress.
I’d forgotten something in this piece of code to retrieve the information? Thank you for your help.
$field_name = "competences_souhaitees";
$field = get_field_object($field_name);
$field_key = "field_53a2b867d0d6f";
$post_id = 887;
$field = get_field_object($field_key, $post_id);
$field_key = "field_53a2b867d0d6f";
$field = get_field_object($field_key);
$sel = 0;
if (isset($posted['comp_job']) && $posted['comp_job']>0) $sel = $posted['comp_job'];
{
foreach( $field['choices'] as $k => $v )
{
?>
<li><label for="<?php echo $k->slug; ?>"><input type="checkbox" name="comp_job[<?php echo $k->slug; ?>]" id="<?php echo $k->slug; ?>" <?php
if (is_array($v) && in_array($k->slug.'', $v)) echo 'checked="checked"';
?> value="show" /> <?php echo $v; ?></label></li>
<?php
}
}
?>