New answers tagged


Your code should work, it might be that your posts per page option in back end is set to 1. It would be beneficial to explicitely set posts_per_page in your query args. You can also make the code faster if you only need to know the amount of grandchild posts, you can just return the post ids's. Here is an example: (Copied and modified from your code) $...

Top 50 recent answers are included