[wp-trac] [WordPress Trac] #37445: Allow to adjust the `$in_admin` property of `WP_Screen`

WordPress Trac noreply at wordpress.org
Sat Jul 23 13:57:29 UTC 2016


#37445: Allow to adjust the `$in_admin` property of `WP_Screen`
----------------------------+-----------------------------
 Reporter:  flixos90        |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  3.5
 Severity:  normal          |   Keywords:  needs-patch
  Focuses:  multisite       |
----------------------------+-----------------------------
 The `$in_admin` property of the `WP_Screen` class is impossible to be
 changed by a developer at the moment, which makes sense in how WordPress
 uses it.

 However, I'm currently building a plugin that creates an additional
 administration panel (like network and user admin) and I would need to
 adjust the `$in_admin` property to reflect when this panel is active.
 Otherwise a function like `is_blog_admin()` returns true although we
 actually aren't in the regular admin panel (since the value of `$in_admin`
 defaults to 'site').

 So I'm proposing to either make the property public so that a developer
 can override it (for example on the `current_screen` action) or to add a
 new filter for the property specifically in `WP_Screen::get()`. I would
 prefer the second approach since having the property being protected makes
 sense in general. The use-case I have is a very rare one, so I think a
 very specific filter for it should do.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37445>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list