Incorrect post `guid` in database

This topic contains 1 reply, has 2 voices, and was last updated by  Paolo 9 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #47910

    giacomo
    Expired Member
    Post count: 235

    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.

    #47922

    Paolo
    Site Admin
    Post count: 31211
    This reply has been marked as private.
Viewing 2 posts - 1 through 2 (of 2 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount