Title: get_current_screen() ERROR
Last modified: August 19, 2024

---

# get_current_screen() ERROR

 *  [Jonathan Camp](https://wordpress.org/support/users/nampara17/)
 * (@nampara17)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/get_current_screen-error-2/)
 * **This is an old error that was fixed but now seems to be back with v2?**
 * The solution (albeit needs their code modified) is:
 * This can be resolved by adding before that line this:
   `require_once(ABSPATH .'
   wp-admin/includes/screen.php');`
 * Add this to the function e.g.
 * function wplalr_sort_user_last_login_column( $query ) {
 *     ```wp-block-code
       if( !is_admin() ) {    return $query;}require_once(ABSPATH . 'wp-admin/includes/screen.php');$screen = get_current_screen();if( isset( $screen->id ) && $screen->id !== 'users' ) {    return $query;}if( isset( $_GET[ 'orderby' ] ) && $_GET[ 'orderby' ] == 'wplalr_last_login' ) {    $query->query_vars['meta_key'] = 'wplalr_last_login';    $query->query_vars['orderby'] = 'meta_value';}return $query;
       ```
   
 * }
 * Not ideal but will fix until they do.

The topic ‘get_current_screen() ERROR’ is closed to new replies.

 * ![](https://ps.w.org/wp-login-and-logout-redirect/assets/icon-256x256.png?rev
   =3163014)
 * [WP Login and Logout Redirect](https://wordpress.org/plugins/wp-login-and-logout-redirect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-login-and-logout-redirect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-login-and-logout-redirect/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-login-and-logout-redirect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-login-and-logout-redirect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-login-and-logout-redirect/reviews/)

## Tags

 * [get_current_screen](https://wordpress.org/support/topic-tag/get_current_screen/)

 * 0 replies
 * 1 participant
 * Last reply from: [Jonathan Camp](https://wordpress.org/support/users/nampara17/)
 * Last activity: [1 year, 9 months ago](https://wordpress.org/support/topic/get_current_screen-error-2/)
 * Status: not resolved