2

Referring to Settings API in Multisite - Missing update message

It states that:

For network option pages the correct form action URL is:

wp-admin/network/edit.php?action=your_option_name

Note: without a '/' in front

Okay. Let's try it:

<form method="post" action="wp-admin/network/edit.php?action=your_option_page">

Obviously, my options form actually gets submitted to:

http://yourdomain.com/wp-admin/network/wp-admin/network/edit.php?action=your_option_page

Now, adding a '/' in front:

<form method="post" action="/wp-admin/network/edit.php?action=your_option_page">

Submits the form (correctly) to:

http://yourdomain.com/wp-admin/network/edit.php?action=your_option_page

That's right in most cases, I think?

However, I got feedback from some of the users of my plugin, that they get this when submitting the options form:

Not Found The requested URL /wp-admin/network/edit.php was not found on this server.

Is this due to incorrect server configuration for that user, or should I actually stick to the following form action URL to make it work with different server paths:

<form method="post" action="edit.php?action=your_option_page">

Form still submits to correct URL:

http://yourdomain.com/wp-admin/network/edit.php?page=your_option_page

Would the latter form action URL work in all install paths that wordpress supports? (with subdomains, directory paths, etc.). How about the different web servers: Apache, Nginx, IIS

yourdomain.com yourdomain.com/wordpress/ subdomain.yourdomain.com subdomain/yourdomain.com/wordpress/

2

When referring to urls within the network-admin, you should consider the network_admin_url(). core function, that falls back to admin_url() for non-multisite setups.

So try this, using add_query_arg just as @toscho uses in the answer OP links to:

echo esc_url( 
    add_query_arg( 
       'action', 
       'your_option_name', 
       network_admin_url( 'edit.php' ) 
    ) 
);

instead of hard-coding it with possible wrong assumptions of the install path.

Here we escape the output for use in the HTML action attribute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.