Save custom field types with this function…?

How do you know that the checkbox value is not being saved? I’m guessing that it is saved to the database; however, in your code, you do not have any method of setting the “checked” attribute for the checkbox to “checked”. As such, you will not see the boxed checked.

You’ll need something like the following to achieve this effect.

<?php $checked = ( get_the_author_meta( 'test2', $user->ID ) == 'some-value' ) ? ' checked="checked" : ''; ?>
<input type="checkbox" name="test2" id="test2" value="some-value" class="regular-text"<?php echo $checked; ?> /><br />

Just make sure to change “some-value” to the value that you want.