Home Forums General Issues Query posts from post object like a taxonomy


Query posts from post object like a taxonomy

  • Hi guys,

    I’m working on a website for a medicinal retailer. I have custom posts for products and laboratories, and each product post has a post object (relationship) field to assign the corresponding lab.

    Now, what i am searching for some way to show only products from each lab in an archive page, just like it would with a taxonomy. Ex.

    I don’t want to use a taxonomy because i don’t want the costumer to have extra work, like create a lab post and create a lab taxonomy.

    I have found this doc, about reversing the relationship so that i could have the products to be shown in the lab post, and that could be helpfull, but i still wanted to have a kind of archive page separated to do that.

    Querying relationship fields

    Can you help me out achieving this some way? Thanks in advance.

  • I would take a look at the “Simple Taxonomy Query” section over on the WP_Query WordPress Codex page. I’ve set things up on a few sites this way.


  • mannwd: thanks for your reply.

    I may be wrong, but isn’t that method used to query from taxonomies? What i want is to query all posts based on a relationship field value.

    Like, an archive page that shows all products wich the value of the laboratory field is the post X.

    Pls forgive my bad english and thanks for the help.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.