[wp-hackers] Detect Network Admin in admin_init?

Shea Bunge info at bungeshea.com
Fri Nov 22 22:46:43 UTC 2013


Have a look at the is_network_admin() function (
http://queryposts.com/function/is_network_admin/). If the current screen
global is not yet set, it checks the WP_NETWORK_ADMIN constant.


On Sat, Nov 23, 2013 at 9:43 AM, Jeff Rose <jeff at jeffrose.ca> wrote:

> I have a plugin that's doing register_settings on the admin_init hook and
> that is apparently running database queries (to populate some options) even
> on the Network Admin page where it's not necessary.
>
> Is there any way to detect that we're on a Network page (Network Admin
> dashboard etc) during this hook? The $current_screen global doesn't seem to
> be set yet and URL hacking seems... hacky.
>
> Any advice is appreciated as always.
>
> --
> Jeff Rose
> ------------------
> http://www.jeffrose.ca/twitter
> http://www.jeffrose.ca/facebook
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Regards,

Shea Bunge
http://bungeshea.com


More information about the wp-hackers mailing list