• Resolved ricjoh

    (@ricjoh)


    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

    (@fahadmahmood)

    Thank you. It has been fixed.

    Thread Starter ricjoh

    (@ricjoh)

    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 5 years, 3 months ago by ricjoh.
    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    Correct. I am using it in a couple of other plugins, i will fix it there as well. Thank you @ricjoh so much.

    I have updated in the same version, kindly remove and install the plugin again.

    • This reply was modified 5 years, 3 months ago by Fahad Mahmood.
    Thread Starter ricjoh

    (@ricjoh)

    No problem. If you’re on a linux box, tail your error log while you’re developing.

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    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.