So I’m trying to create a meta box checkbox but I can’t get it to function..
the code I’m using is
echo '<label for="myplugin_new_field">' . __("Description for this field", 'myplugin_textdomain' ) . '</label> ';
echo '<input type="checkbox" name="myplugin_new_field" id="myplugin_new_field" value="yes"';
if ( get_post_meta('myplugin_new_field', true ) == "yes" )
echo ' checked="checked"';
echo '" style="width: auto;" />';
}
The checkbox appears in edit post pages without any errors. I check it but after I update the post it becomes unchecked.
Not sure what I’m doing wrong here.. will appreciate any kind of guidance!

I guess I’ll just use arrays. I was hoping to achieve it with the more minimal function reference.