• Hi, i have to structure a wordpress query that displays a specific taxonomy (A) of the post where it is executed and the taxonomy (A) present in all the posts with the same title as the post being executed. How can I start setting up work? Thank you

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Something like this maybe (untested)?
    SELECT * FROM wp_posts LEFT JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id WHERE wp_term_relationships.term_taxonomy_id = 123 AND wp_posts.post_type = 'post' AND wp_posts.post_status = 'publish' AND wp_posts.post_title = 'Current Post Title';

    You need to get the current post’s taxonomy term’s ID from the WP_Term object and use it in place of 123. Use the current post’s title in place of Current Post Title.

Viewing 1 replies (of 1 total)
  • The topic ‘Help with Query’ is closed to new replies.