Support

Account

Home Forums General Issues How to filter custom field object by related custom field ? Reply To: How to filter custom field object by related custom field ?

  • You cannot query a post type based on data stored for second post type.

    You have a couple of choices.

    1) You do a query on the second post type to get posts filtered by the custom field. You then use the returned post IDs to query and filter the first post type.

    2) When saving post type 1 you copy the data in the meta fields from the related post type 2 to meta field for post type 1. You then can query post type 1 directly using this data.