Notice from get_current_screen on all admin pages. #217

dancameron opened this Issue Aug 20, 2012 · 3 comments


None yet

2 participants


Check to make sure get_current_screen doesn't simply return null before objectifying it.

"Notice: Trying to get property of non-object in /.../wordpress/wp-content/plugins/posts-to-posts/core/url-query.php on line 27"

scribu commented Aug 20, 2012

I can't reproduce the notice. This seems to me like some other code is whipping away the $current_screen global by mistake.


Okay, I'll test more and see if it's a conflict somewhere else.

scribu commented Sep 9, 2012

A user in the support forums was able to shed light on the matter:

I have a helper function that is pulling a list of users (via WP's get_users), which is triggering P2P_URL_Query::user_query before get_current_screen is available. I'm working on excluding this function from the pre_user_query filter altogether, but I think it's worth being aware of: the pre_user_query filter is set up at init, but get_current_screen isn't available at init, according to - it is available for any action after admin_init

@scribu scribu closed this in 6855881 Sep 9, 2012
@dbernar1 dbernar1 pushed a commit to dbernar1/wp-posts-to-posts that referenced this issue Oct 1, 2014
@scribu don't assume a current screen exists in P2P_URL_Query::user_query(). …
…fixes #217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment