From b7d866b5ca72fbca9a900548b463578fb8d02ac0 Mon Sep 17 00:00:00 2001 From: dabaaaz <1432848+dabaaaz@users.noreply.github.com> Date: Sun, 6 Nov 2022 16:19:49 +0100 Subject: [PATCH] Update wp-favorite-posts.php Fix warning if $post is empty --- wp-favorite-posts.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-favorite-posts.php b/wp-favorite-posts.php index 6970ee2..95594ad 100644 --- a/wp-favorite-posts.php +++ b/wp-favorite-posts.php @@ -149,7 +149,11 @@ function wpfp_check_favorited($cid) { function wpfp_link( $return = 0, $action = "", $show_span = 1, $args = array() ) { global $post; //print_r($post); - $post_id = &$post->ID; + + if (!is_null($post)) { + $post_id = &$post->ID; + } + extract($args); $str = ""; if ($show_span)