• Resolved ailaina123456

    (@ailaina123456)


    Hi,

    I am having this error coming up in the debug log error doc.

    [16-Aug-2023 04:57:46 UTC] PHP Warning: Attempt to read property “post_author” on null in /home//public_html/wp-content/plugins/widget-options/includes/widgets/display.php(428) : eval()’d code on line 1

    For one widget I am using this logic:

    global $post; return($post→post_author==1);

    Thanks

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mej de Castro

    (@mej)

    Hi @ailaina123456 ,

    Could you please try this logic:
    global $post; return($post && $post->post_author == 1);

    You have to check first that $post is set before calling one of its values. Please note that $post is not set on some pages, example: archive pages.

    Thank you,
    Mej

    Thread Starter ailaina123456

    (@ailaina123456)

    Hi,

    This widget is only used in custom posts. It was working perfectly until a few days back were it stopped working and started to throw errors.

    How can I “check if that $post is set before calling one of its values.”?

    Thanks

    Plugin Author Mej de Castro

    (@mej)

    Is global $post; return($post && $post->post_author == 1); not working on your website too?

    Thread Starter ailaina123456

    (@ailaina123456)

    This one is working ????

    Thanks a lot!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Debug log errors’ is closed to new replies.