Hi,
I’m developing a “Welcome, user!” widget in my home page (see screenshot attached): I want to display the title of the listing the current user commented lastly; to do so, I added a function in my_template/functions.php which queries the following:
“SELECT * FROM $wpdb->comments WHERE comment_approved = ‘1’ AND
user_id
= $userId ORDER BY comment_date_gmt DESC LIMIT 1″
Everything here works fine, and after getting the
comment_post_ID
from the
comments
table, I use the WordPress default function “get_post(<post_id>)” to retrieve all the information about that specific post, including its link in the
guid
field.
The problem is that the guid stored in the database doesn’t match with the real one; e.g.:
stored on database: <domain>/it/places/italy/tuscany/florence/viaggi-organizzati-mtk/
real one: <domain>/it/musei/italy/tuscany/florence/viaggi-organizzati-mtk/
This seems to happen only for that listing but I’m looking deeply if I can find more.
Can you help me?
Thanks,
Daniele C.