• Hi! I made a page which shows a list of posts that belongs to a new post type (named ‘fitxes’) I created. This is the query I use to show the list of posts (fitxes):

    SELECT DISTINCT p.post_title, p.post_name, t.name, p.ID
    FROM wp_posts p, wp_postmeta pm, wp_terms t, wp_term_taxonomy tt, wp_term_relationships tr
    WHERE p.post_status = 'publish'
    AND p.post_type = 'fitxes'
    AND pm.post_id = p.ID
    AND t.term_id = tt.term_id
    AND tt.term_taxonomy_id = tr.term_taxonomy_id
    AND tr.object_id = p.ID

    But I have a problem. It is that when I delete a post, it still appears in my list. But it does not appear in the admin page (that is what I want).

    What is wrong in my query? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    I haven’t a clue re: the query above – though just thought I would mention, deleted posts are usually still in the trash/bin. Could be a cause of issues…

    Thread Starter ADQA

    (@adqa)

    Thanks for your response, Colin.

    I watched the trash, but unfortunatelly, the posts aren’t here neither. Only in my list ??

    Thread Starter ADQA

    (@adqa)

    I found it!

    This is the query:

    SELECT DISTINCT p.post_title, p.post_name, t.name, p.ID
    FROM wp_posts p, wp_postmeta pm, wp_terms t, wp_term_taxonomy tt, wp_term_relationships tr, wp_icl_translations wpml
    WHERE p.post_status = 'publish'
    AND p.post_type = 'fitxes'
    AND pm.post_id = p.ID
    AND t.term_id = tt.term_id
    AND tt.term_taxonomy_id = tr.term_taxonomy_id
    AND tr.object_id = p.ID
    AND p.ID = wpml.element_id
    AND wpml.element_type= 'post_fitxes'
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘My $query still shows deleted posts’ is closed to new replies.