Title: PHP Error
Last modified: November 22, 2019

---

# PHP Error

 *  Resolved [ricjoh](https://wordpress.org/support/users/ricjoh/)
 * (@ricjoh)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-error-354/)
 * Can you fix this? It’s cloggin my error log:
 * Trying to get property ‘id’ of non-object in /web/html/kmccontrols.com/wp-content/
   plugins/wp-sort-order/inc/hooks.php on line 55
 * “global $current_screen” is a bad idea. Use get_current_screen() and make sure
   it’s defined before checking the id, please.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * (@fahadmahmood)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-error-354/#post-12162276)
 * Thank you. It has been fixed.
 *  Thread Starter [ricjoh](https://wordpress.org/support/users/ricjoh/)
 * (@ricjoh)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-error-354/#post-12162329)
 * Thanks, but…
 * I don’t think you understood both parts. You are using get_current_screen(), 
   but I still get the error, because you’re not ensuring it’s an object.
 * `Trying to get property 'id' of non-object in /web/html/kmccontrols.com/wp-content/
   plugins/wp-sort-order/inc/hooks.php on line 57`
 * It’s being called by a script where there is no screen set.
 * Make line 57 read:
    `if ( ! is_object( $screen ) or 'users' != $screen->id )`
 * So if there’s not a screen defined, it won’t fail.
    -  This reply was modified 6 years, 6 months ago by [ricjoh](https://wordpress.org/support/users/ricjoh/).
 *  Plugin Author [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * (@fahadmahmood)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-error-354/#post-12162344)
 * Correct. I am using it in a couple of other plugins, i will fix it there as well.
   Thank you [@ricjoh](https://wordpress.org/support/users/ricjoh/) so much.
 * I have updated in the same version, kindly remove and install the plugin again.
    -  This reply was modified 6 years, 6 months ago by [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/).
 *  Thread Starter [ricjoh](https://wordpress.org/support/users/ricjoh/)
 * (@ricjoh)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-error-354/#post-12162353)
 * No problem. If you’re on a linux box, tail your error log while you’re developing.
 *  Plugin Author [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * (@fahadmahmood)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/php-error-354/#post-12162973)
 * I have updated in the same version, kindly remove and install the plugin again.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP Error’ is closed to new replies.

 * ![](https://ps.w.org/wp-sort-order/assets/icon-256x256.png?rev=1362889)
 * [WP Sort Order](https://wordpress.org/plugins/wp-sort-order/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-sort-order/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-sort-order/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-sort-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-sort-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-sort-order/reviews/)

## Tags

 * [PHP Bug](https://wordpress.org/support/topic-tag/php-bug/)

 * 5 replies
 * 2 participants
 * Last reply from: [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/php-error-354/#post-12162973)
 * Status: resolved