WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom content type of tab_content with a relationship to a page.

In my current script I have the id of a page and I want to do a query that will list all the children of type tab_content that have the relationship of a page with the specified id.

All I have so far is:

new WP_Query(array('post_type' => 'tab_content'));

How do I tell the query that the custom field parent needs to be something like 80? Thanks

share|improve this question

You can try using the post_parent paramter or WP_Query ex:

new WP_Query(array(
    'post_type' => 'tab_content',
    'post_parent' => 80
share|improve this answer

I'm actually using a relation from the custom post type plugin.

I had to reference a custom field which gave me the whole reference post.

get_custom_field('tab_content_relationship'); and viola.

share|improve this answer

The only way to do what you want with WP_Query is to use two queries:

  1. Get the list of IDs of tab_content posts associated with a page.
  2. Query for children of those IDs.

You could use get_posts() for the first query if you want, but that's all I can think of.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.