Skip to:
Content
Pages
Categories
Search
Top
Bottom

Get forum of Reply from database


  • Biswadip
    Participant

    @biswadip

    I want the latest posts (topics or replies) from a specific forum. I can get the latest posts from all forums with something like:

    SELECT * FROM wp_posts WHERE post_type = ‘reply’ OR post_type = ‘topic’ ORDER BY post_date DESC LIMIT 4

    What I need to do is to specify the forum of the topic or reply by adding a condition saying something like:

    If it is a reply get the parent of the parent_type (i.e. the specific forum which is the parent of the topic) and if it is a topic get the parent_type (which I can get from the wp_posts table). Then check if this matches the specific forum we want.

    No idea how to do this though (especially the parent of the parent_type bit)……..

Viewing 1 replies (of 1 total)

  • Biswadip
    Participant

    @biswadip

    Sorry this should be in the Troubleshooting section – not sure how to move it though.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.