The MU forums have moved to WordPress.org

Making an option page in WPMU (2 posts)

  1. mrzerog
    Member
    Posted 14 years ago #

    Hello all.
    I am following these instructions here to create an options page under general settings. But when I press save changes, I get the error that options.php does not exist (which of course it does). So obviously there is a special secret hard to find way to interface options pages with WPMU, and i was wondering if any of you knew where I could find some info about that. I would check the docs but as we all know docs don't exist for wpmu.

    Thanks,
    Joe

  2. mrzerog
    Member
    Posted 14 years ago #

    Okay, I figured it out by following the options-misc.php example.

    First thing, you have to create the admin menu items like in the link.

    add_action('admin_menu', 'my_settings');

    Then, because it's wpmu, you HAVE TO register the settings with a function hooked into the admin_init.

    add_action('admin_init', 'register_my_settings')
    {
    register_setting('my_settings_group','my_setting_name');
    register_setting('my_settings_group', 'my_other_setting_name');
    }

    Then you have to make a form and do overything like it says in the link, but instead of putting in the hiden fields (nonce, action, etc)
    include this INSIDE THE FORM somewhere.

    <?php settings_fields('my_settings_group'); ?>

    Then also include this INSIDE THE FORM somewhere:

    <?php do_settings_sections('my_settings_section'); ?>

    I do not know the difference between what these two functions do. It is a great mystery that will probably never be solved, but you need them both.

    THEN you also have to make all the input fields and submit button like in the link.

    And then it should work.

About this Topic