Plugin – Custom settings won’t save
-
Hi,
I’m trying to make a plugin which has settings on a custom page within the WordPress admin area but it’s not working at all.
I have a new page located at
admin.php?page=CustomPlugin
.Then, in a function I have the following:
add_option('abc_plugin', '0'); register_setting('abc_plugin_group', 'abc_plugin');
Which is working because it’s adding the settings to the database which is fine. However when I go to my page, I edit the fields and save but non of the options are being updated.
I’ve got the following functions in my template:
<form method="post" name="core-settings"> <?php settings_fields('abc_plugin_group'); do_settings_sections('abc_plugin_group'); ?> [...] <?php submit_button(); ?> </form>
What am I doing wrong here?
Do I need to use
add_settings_section()
andadd_settings_field()
because I’ve checked other plugins and they don’t seem to use these functions because they’re on special, custom plugin pages.Please help!
- The topic ‘Plugin – Custom settings won’t save’ is closed to new replies.