How do I save custom options on the options page ‘Reading’?

I want to add some options to the default “Reading” options page. The code I have is:

    add_settings_section("section_share", __("Sharing & Publishing", "honeycomb-wp"), __NAMESPACE__."\\displaySection",
                        "reading");
   register_setting("group_share", "honeycomb-reading-share");
   register_setting("group_share", "honeycomb-reading-tweet");
   register_setting("group_share", "honeycomb-reading-delay");
   register_setting("group_share", "honeycomb-reading-footer");

   add_settings_field("honeycomb-reading-share", __("Share", "honeycomb-wp"), __NAMESPACE__."\\displayField_share",
                      "reading", "section_share");
   add_settings_field("honeycomb-reading-tweet", __("Tweet", "honeycomb-wp"), __NAMESPACE__."\\displayField_tweet",
                      "reading", "section_share");
   add_settings_field("honeycomb-reading-delay", __("Delay", "honeycomb-wp"), __NAMESPACE__."\\displayField_delay",
                      "reading", "section_share");
   add_settings_field("honeycomb-reading-footer", __("Footer in RSS", "honeycomb-wp"), __NAMESPACE__."\\displayField_footer",
                      "reading", "section_share");

(in the admin_init hook). This displays the options nicely on the page, but won’t save them. Is there a hook for this, or is it impossible to add an extra section to this page?

1 Answer
1

Found it; One needs to use a so-called ‘whitelisted’ group:

register_setting("reading", "honeycomb-reading-share");

Existing option-pages seem to all have a group-name that corrsponds to their page-name.

Leave a Comment