• Resolved coolex123

    (@coolex123)


    Hello,

    I’ve tried creating custom checkbox field with some options but it doesn’t register options at all. It created the field but there are no options that you can select. I’ve tried creating it same as select field. Example of code is below. Thanks for help.

    add_filter(
    ‘auto_listings_metabox_specs’,
    function ( $fields ) {
    $prefix = ‘_al_listing_’;
    $fields[7] = array(
    ‘name’ => __( ‘Some field’, ‘auto-listings’ ),
    ‘id’ => $prefix . ‘some_field’,
    ‘type’ => ‘checkbox’,
    ‘placeholder’ => ‘…’,
    ‘options’ => [
    ‘1’ => ‘Some option 1’,
    ‘2’ => ‘Some option 2’,
    ],
    );
    return $fields;
    }
    );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to add options to the custom checkbox field?’ is closed to new replies.