how to correctly setup a single checkbox meta?

Home Forums WPAlchemy how to correctly setup a single checkbox meta?

Tagged: 

This topic contains 2 replies, has 1 voice, and was last updated by  stratboy 1 year, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2554

    stratboy
    Participant

    Hi! How can I correctly setup a single checkbox meta? Cannot find this kind of info…

    #2559

    stratboy
    Participant

    So, I’ve tried your example:
    <?php $mb->the_field(‘cb_single’); ?>
    <input type=”checkbox” name=”<?php $mb->the_name(); ?>” value=”abc”<?php $mb->the_checkbox_state(‘abc’); ?>/> abc<br/>

    It doesn’t get saved.

    In MetaBox class, _save() method, lines 2216-2235, this code:

    var_dump($new_data);

    the first time shows me the checkbox data, the second time, after filtering it (apply_filters(‘save’)..), it becomes NULL.

    So, am I doing something wrong? How can I fix it and get my single checkbox saved?

     

    #2560

    stratboy
    Participant

    ok. found the problem. I applied a filter that didn’t correctly return $meta.

    fine. solved. Thank you anyway.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.