Settings array empty
nine-2-five opened this issue · 3 comments
On init, the instance of this plugin contains the object WordPress_Plugin_Template_Settings, but its field 'settings' is an empty array.
Is it my responsibility to create/load this array with plugin settings or should this happen automagically?
WordPress_Plugin_Template_Settings has settings which are automatically added to the settings array by the settings_fields() function, These settings are only examples. You will need to edit that function to create the setting fields that will work for your plugin.
Yeah I created the new settings fields, and they save to db ok. But I don't know whether there's a simpler way than get_option('prefix_fieldnam') for each field.
Is it possible to get an array of all the settings at once?
You can get all options with https://codex.wordpress.org/Function_Reference/wp_load_alloptions
but I don't know of any built in way to get all options for one plugin.
You could create your own function to limit the results to certain options by copying that function, renaming the copy, and modifying the query. .