complex get_posts() query to select child pages

You need a loop for this to handle the condition: /** list for course and childless department pages */ $course_and_childless_department_pages = array(); /** get department pages */ $department_pages = get_children( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ) ); foreach ( $department_pages as $department_page ) { /** get course pages (for department … Read more

wp_query serialised array

As I commented, if the meta value is a serialized string of an array like array( ‘Melbourne’, ‘Sydney’ ), then ‘value’ => ‘”(Melbourne|Sydney)”‘, ‘compare’ => ‘REGEXP’ would work. So there’s no need for a complex regular expression pattern, and your meta_query could look like so where $locations is an array of locations: ‘meta_query’ => array( … Read more