Title: PHP Warning
Last modified: June 13, 2021

---

# PHP Warning

 *  [Erfan MHDi](https://wordpress.org/support/users/erfanmhd/)
 * (@erfanmhd)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/php-warning-292/)
 * hello,
 * i got a PHP warning when i click on ADD(or Remove) favorite link on post page.
 *     ```
       Warning: Creating default object from empty value in /home/wp-content/plugins/wp-favorite-posts/wp-favorite-posts.php on line 152
       ```
   
 * the plugin is working just fine but i’ll appreciate it if you guys could give
   me a hint on how can fix this so the warning message goes away.
 * here is the line of codes that the warning message is referring to :
 *     ```
       function wpfp_link( $return = 0, $action = "", $show_span = 1, $args = array() ) {
           global $post;
           //print_r($post);
           $post_id = &$post->ID;    <=== This is the line 152
           extract($args);
           $str = "";
           if ($show_span)
               $str = "<span class='wpfp-span'>";
           $str .= wpfp_before_link_img();
           $str .= wpfp_loading_img();
           if ($action == "remove"):
               $str .= wpfp_link_html($post_id, wpfp_get_option('remove_favorite'), "remove");
           elseif ($action == "add"):
               $str .= wpfp_link_html($post_id, wpfp_get_option('add_favorite'), "add");
           elseif (wpfp_check_favorited($post_id)):
               $str .= wpfp_link_html($post_id, wpfp_get_option('remove_favorite'), "remove");
           else:
               $str .= wpfp_link_html($post_id, wpfp_get_option('add_favorite'), "add");
           endif;
           if ($show_span)
               $str .= "</span>";
           if ($return) { return $str; } else { echo $str; }
       }
       ```
   
 * Thanks

Viewing 1 replies (of 1 total)

 *  [btopalacios](https://wordpress.org/support/users/btopalacios/)
 * (@btopalacios)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-292/#post-14922629)
 * could you solve it?

Viewing 1 replies (of 1 total)

The topic ‘PHP Warning’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-favorite-posts.svg)
 * [WP Favorite Posts](https://wordpress.org/plugins/wp-favorite-posts/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-favorite-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-favorite-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-favorite-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-favorite-posts/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [btopalacios](https://wordpress.org/support/users/btopalacios/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/php-warning-292/#post-14922629)
 * Status: not resolved