Using the following code for the custom checkbox to save an array of values. When the [] is left off everything works, when it's added back to save the value as an array it does not work. Any ideas...?
$posts = get_posts("post_type=test&orderby=title&order=ASC&numberposts=1000");
foreach ($posts as $postv) {
$postname = $postv->post_title;
$postslug = $postv->post_name;
<input type="checkbox" name="' . $this->prefix . $customField['name'] . '[]"
value="' . $postslug . '" ';
$sponsorselected = get_post_meta($post->ID, 'eventsponsor', $single = true);
if ((!empty($sponsorselected))&&(in_array($postslug,$sponsorselected))
{echo 'checked '; }
echo 'style="width: auto;border:0;" />
foreach ( $this->customFields as $customField ) {
if ( current_user_can( $customField['capability'], $post_id ) ) {
if ( isset( $_POST[ $this->prefix . $customField['name'] ] ) && trim( $_POST[
$this->prefix . $customField['name'] ] ) ) {
update_post_meta( $post_id, $this->prefix . $customField[ 'name' ], $_POST[
$this->prefix . $customField['name'] ] );
} else {
delete_post_meta( $post_id, $this->prefix . $customField[ 'name' ] );
}
}
}