Title: Debug log errors
Last modified: August 16, 2023

---

# Debug log errors

 *  Resolved [ailaina123456](https://wordpress.org/support/users/ailaina123456/)
 * (@ailaina123456)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/debug-log-errors-4/)
 * 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](https://wordpress.org/support/users/mej/)
 * (@mej)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/debug-log-errors-4/#post-16979530)
 * Hi [@ailaina123456](https://wordpress.org/support/users/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
    -  This reply was modified 2 years, 9 months ago by [Mej de Castro](https://wordpress.org/support/users/mej/).
 *  Thread Starter [ailaina123456](https://wordpress.org/support/users/ailaina123456/)
 * (@ailaina123456)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/debug-log-errors-4/#post-16980158)
 * 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](https://wordpress.org/support/users/mej/)
 * (@mej)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/debug-log-errors-4/#post-16983197)
 * Is **global $post; return($post && $post->post_author == 1);** not working on
   your website too?
 *  Thread Starter [ailaina123456](https://wordpress.org/support/users/ailaina123456/)
 * (@ailaina123456)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/debug-log-errors-4/#post-16983924)
 * 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.

 * ![](https://ps.w.org/widget-options/assets/icon-256x256.gif?rev=2513739)
 * [Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets](https://wordpress.org/plugins/widget-options/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-options/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-options/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-options/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-options/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-options/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [ailaina123456](https://wordpress.org/support/users/ailaina123456/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/debug-log-errors-4/#post-16983924)
 * Status: resolved