• How to save form data in option page for all sites in wordpress multisite?

    I use this code:

    <div class="wrap">
                        <h2>Test</h2>
                        <form method="post" action="options.php">
                            '.wp_nonce_field('update-options').'
                            <p><strong style="float:left;padding-top:2px;">test:</strong>&nbsp;&nbsp;
                                <label class="switch">
                                    <input type="checkbox" class="switch-input" name="test_value" ' . $checkbox_checked . '>
                                    <span class="switch-label" data-on="On" data-off="Off"></span>
                                    <span class="switch-handle"></span>
                                </label>
                            </p>
                            <p><input type="submit" name="Submit" value="Salva" /></p>
                            <input type="hidden" name="action" value="update" />
                            <input type="hidden" name="page_options" value="test_value" />
                        </form>
                    </div>

    But is saved in wp_postmeta.
    I would like to save wp_sitemeta.

    is it possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Calling options.php won’t work anyway. It’s not available to every site admin on a network, just the super admin.

    http://codex.ww.wp.xz.cn/Function_Reference/add_site_option

    You’ll want your form to be on a network admin page by the way.

    Thread Starter richard81

    (@richard81)

    ok option.php not right for me.
    But I did not understand what solution follow.

    I have not used anywhere function add_option.
    Is in the file option.php?
    How can I make him enter the function add_site_option?

    thanks to the support

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    The solution is for you to properly use add_site_option. That adds an option for the network, not just a site.

    Essentially the same as add_option() but works network wide when using WP Multisite.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘save data form for all network in multisite’ is closed to new replies.