To allow users with capabilities other than manage_options
to save a setting you can use the option_page_capability_{$option_page}
hook. Despite the name, {$option_page}
is the option group, which is what you set for the first argument of register_setting()
and settings_fields()
on your options page.
So if you registered a setting:
register_setting( 'wpse_310606_setting_group', 'wpse_310606_setting' );
You can allow other capabilities to save it with:
function wpse_310606_setting_capability( $capability ) {
return 'edit_pages';
}
add_filter( 'option_page_capability_wpse_310606_setting_group', 'wpse_310606_setting_capability' );
Editors and Administrators both have the edit_pages
capability, so this would allow both roles to save this settings group.