Title: Warning in PostHooks.php
Last modified: January 23, 2025

---

# Warning in PostHooks.php

 *  [temark](https://wordpress.org/support/users/temark/)
 * (@temark)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/warning-in-posthooks-php/)
 * Hi,
 * I’ve encountered the following warning while using the plugin. It occurs in the
   related posts loop for blog posts.
 * > Warning: Attempt to read property “post_type” on int in /plugins/favorites/
   > app/Entities/Post/PostHooks.php
 * It seems `$post` is expected to be an object but may sometimes be an integer,
   causing the warning. Since I don’t need the Favorites button to appear in the
   related posts loop, adding a check to ensure `$post` is an object would resolve
   the issue.
 * Could you look into this? Much thanks!

The topic ‘Warning in PostHooks.php’ is closed to new replies.

 * ![](https://ps.w.org/favorites/assets/icon-128x128.png?rev=1677726)
 * [Favorites](https://wordpress.org/plugins/favorites/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/favorites/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/favorites/)
 * [Active Topics](https://wordpress.org/support/plugin/favorites/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/favorites/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/favorites/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [temark](https://wordpress.org/support/users/temark/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/warning-in-posthooks-php/)
 * Status: not resolved