get_current_screen() ERROR
-
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 ) {
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.
- You must be logged in to reply to this topic.