I'm having trouble getting a custom plugin to save options, as it cannot find options.php (and I don't know where it's supposed to be)
The full code for the plugin:
add_action( 'admin_menu', 'dotmailer_menu' );
function dotmailer_menu() {
add_options_page( 'Dotmailer Options', 'Dotmailer Details', 'manage_options', 'dotmailer', 'dotmailer_options' );
}
function dotmailer_options() {
?>
<div class="wrap">
<form method="post" action="options.php">
<?php settings_fields( 'settings-group' ); ?>
<?php do_settings_sections( 'settings-group' ); ?>
<label>API key</label><br />
<input type="email" name="apiemail" value="<?php echo get_option('apiemail'); ?>"><br />
<label>Password</label><br />
<input type="password" name="apipassword" value="<?php echo get_option('apipassword'); ?>"><br />
<p><input type="submit" value="Save" class="button-primary" /></p>
</form>
</div>
<?php
}
function register_settings() {
register_setting('settings-group','apiemail');
register_setting('settings-group','apipassword');
}
When I submit the form, it simply returns an error saying that it cannot find options.php.
Am I supposed to create options.php myself? I have used similar code before without creating options.php myself and not had a problem.