Title: Error when $post object does not exist
Last modified: November 8, 2019

---

# Error when $post object does not exist

 *  [Kevin Hagerty](https://wordpress.org/support/users/khag7/)
 * (@khag7)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/error-when-post-object-does-not-exist/)
 * Your plugin runs the load_scripts function with the wp_enqueue_scripts hook. 
   This means that function is called on every page load. But not every page load
   has a $post object. This results in an error thrown when $post does not exist.
 * Please add at line 134:
    if( !$post ) return;

The topic ‘Error when $post object does not exist’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/hide-title.svg)
 * [Hide Title](https://wordpress.org/plugins/hide-title/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hide-title/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hide-title/)
 * [Active Topics](https://wordpress.org/support/plugin/hide-title/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hide-title/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hide-title/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Kevin Hagerty](https://wordpress.org/support/users/khag7/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/error-when-post-object-does-not-exist/)
 * Status: not resolved