My current idea is:
- Use
get_pages
to get all of the descendants of TOP and put the IDs in an arrayarrayAll
. - Then run
get_pages
again withparent=1
to get just the direct children of TOP. Put these in arrayarrayChildren
. - Run in php
arrayGrandchildren = array_diff(arrayAll, arrayChildren)
to get a list of all pages from the first array (which contains all descendants of TOP) that do not include the direct children. - In
WP_Query
, set ‘post_in=arrayGrandchildren&order=rand
‘ to get random posts from the list of grandchildren.