Skip to content

Instantly share code, notes, and snippets.

@DrewAPicture
Last active September 29, 2015 21:29
Show Gist options
  • Save DrewAPicture/c4c067788d6262aa30b0 to your computer and use it in GitHub Desktop.
Save DrewAPicture/c4c067788d6262aa30b0 to your computer and use it in GitHub Desktop.
<?php
/*
* If hierarchical is false, and child_of is not empty, pages will (apparently) be returned
* hierarchically anyway in order of creation: 3, 4, 5.
*/
$this->assertEqualSets( array( $page_3, $page_4, $page_5 ), wp_list_pluck( $pages, 'ID' ) );
// How it should work.
$found_pages = wp_list_filter( $pages, array( 'post_parent' => $page_1 ) );
$this->assertEqualSets( array( $page_3, $page_5 ), wp_list_pluck( $found_pages, 'ID' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment