PHP8 Fatal Error triggered on search results page, resolved.
-
If you get this error:
Fatal error: Uncaught Error: Attempt to modify property “ID” on null in wp-content/plugins/wp-favorite-posts/wp-favorite-posts.php:152It is because it is trying to assign the value of the $post->ID property to $post_id, but $post may not exist or may be null.
You can fix this error by checking if $post exists before accessing its properties. Here’s an updated version of line 152 to include the check:
$post_id = isset($post) ? $post->ID : null;
- The topic ‘PHP8 Fatal Error triggered on search results page, resolved.’ is closed to new replies.