I am setting up my plugin’s settings page and I am able to get the fields I want on the page, but I want them to be dropdowns not textboxes… I have not found any useful info on the web on how to do this other than using add_settings_field. With add_settings_field I can display a dropdown for my setting but I can’t get it to appear on my plugin settings page, I can get it to appear on the ‘reading settings page’ though for example.
basically I have used
add_options_page() so that my Plugin Options page shows up under the settings menu in the wordpress backend, and addaction() to register my settings, and the form is built with the callback function from add_options_page. This all works, I just can’t get anything but textboxes… and I would like dropdowns and probably checkboxes.
I hope that makes sense.
Thanks!
It sounds like you have some of your Settings API calls wrong. Your dropdown input is created in the callback of your add_settings_field(). Each settings field needs to be told which settings section it is part of, and then your options page communicates which settings sections it needs to display through the do_settings() function.
Here’s a short code example using a checkbox (omitting a few of the callback functions, but ALL of your callbacks need to be valid functions– even if you make them empty functions):