WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 3 months ago

#22589 new enhancement

Network Admin + Ajax requests

Reported by: dd32 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords:
Focuses: multisite, administration Cc:

Description

Currently there is no Network admin based ajax handler, forcing plugins which exist solely within the Network Admin to either use wp-admin/admin-ajax.php or using the load-{$page_hook} hook to perform any actions.

This is primarily a problem when the plugin only includes code on a conditional such as is_network_admin(), which would be false for a /wp-admin/admin-ajax.php request, as a result, only the load-{$page_hook} option above is viable for those.
As a work around, plugins can include code on is_network_admin() || DOING_AJAX to allow the usage of admin-ajax.php.

Of course, the User Admin also suffers the same issue.

I didn't see any previous tickets, and kind of want to say the existing 'workaround' is appropriate, but recording it here so we can at least close it as wontfix if appropriate.

Change History (6)

comment:1 toscho17 months ago

  • Cc info@… added

comment:2 scribu17 months ago

  • Type changed from feature request to enhancement

I don't think the workaround is appropriate; it's a hack.

We should have a dedicated /wp-admin/network/admin-ajax.php file, which contains all the network-specific ajax handlers.

comment:3 TroyDesign10 months ago

+1 I have same problem.
I wrote a small workaroud:

if (defined('DOING_AJAX') && DOING_AJAX && is_multisite() && preg_match('#^'.network_admin_url().'#i',$_SERVER['HTTP_REFERER'])) {
	define('WP_NETWORK_ADMIN',true);
}

comment:4 ocean9010 months ago

  • Cc ocean90 added

comment:5 jeremyfelt3 months ago

  • Component changed from Administration to Network Admin
  • Focuses multisite added

comment:6 nacin3 months ago

  • Component changed from Network Admin to Networks and Sites
  • Focuses administration added
Note: See TracTickets for help on using tickets.