I have two option callbacks in my plugin, one with a ckeckbox and one with a select field. The first one is working perfectly, the second not. The select field doesn't save its value. I double checked the code which registers the two settings, I assume my mistake is somewhere in the callback.
Any ideas?
Checkbox (works):
public function myplugin_post_menu_cb() {
echo '<input type="checkbox" name="' . $this->option_name . '_post_menu' . '" value="1" "' . checked(1, get_option('myplugin_post_menu'), false) . '" />';
}
Select (doesn't work):
public function myplugin_admin_bar_cb() {
echo '<select name="' . $this->option_name . '_admin_bar' . '">';
echo '<option value="1" "' . selected( get_option('myplugin_admin_bar'), 1 ) . '">1</option>';
echo '<option value="2" "' . selected( get_option('myplugin_admin_bar'), 2 ) . '">2</option>';
echo '</select>';
}
Thanks for the help.