Updating post meta for checkbox

<div class=”vp-field vp-checkbox vp-checked-field vp-meta-single” data-vp-type=”vp-checkbox” id=”_custom_meta[category][]”>
<div class=”label”>
<label>Categories</label>
</div>
<div class=”field”>
<div class=”input”>
<label>
<input class=”vp-input” type=”checkbox” name=”_custom_meta[category][]” value=”star”>
<span></span>star</label>
<label>
<input class=”vp-input” type=”checkbox” name=”_custom_meta[category][]” value=”triangle”>
<span></span>triangle</label>
<label>
<input class=”vp-input” type=”checkbox” name=”_custom_meta[category][]” value=”square”>
<span></span>square
</label>
</div>
</div>
</div>’

I am trying to update the post meta checkboxes, but the below is not working. Any suggestions what i am doing wrong.

$features[0] = “star”;
$features[1] = “triangle”;
$features[2] = “square”;

update_post_meta($post_id, “category”,$features);

Read more here:: Updating post meta for checkbox

Leave a Reply

Your email address will not be published. Required fields are marked *