I need help with a code to customize the category taxonomies in the frontend. It's a code from a plugin:
// Categories
$vvc_categories = wp_get_post_terms( $vvc_id, 'vvc_tax_cat', array( "fields" => "ids" ) );
$out .= '<label for="vvc_categories">' . esc_html__( 'VVC Kategorien', 'vvc_textdomain' ) . '</label>';
$out .= '<div class="form-input">';
foreach ( $vvc_post_categories as $key => $value ) {
$out .= '<input type="checkbox" name="vvc_categories[]" class="vvc_categories" id="vvc_categories" multiple="multiple">';
$selected = ( is_array( $vvc_categories ) && in_array( $key, $vvc_categories ) ) ? ' selected="selected"' :'';
$out .= '<option type="checkbox" value="' . esc_attr( $key ) . '" ' . $selected . '>' . esc_html( $value ) . '</option>';
}
$out .= '</input>';// .vvc_categories
$out .= '</div>'; // .form-input
I changed the type from "select" to "checkbox". More precisely I changed "select" to "input" and added the "type="checkbox"".
As a result I got the checkboxes but when I hit submit the categories were not saved. All worked fine with the select version. Maybe someone got a hind for me. Any help is appreciated