0

I used custom post types UI to create a custom post type (kennisbank)

Now within this custom post type I have both parent articles and child articles, as I made this custom post type hierarchical. I like to only display the parent articles on the archive page.

Can anyone explain me how to do this?

0

I hadn't tried this in practice, but theoretically should be easy.

  1. post_parent argument in query set to 0 should limit it to parent items, see Post & Page Parameters.

  2. Use pre_get_posts hook to correctly adjust main query, adding that argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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