'menu_order', 'sort_order' => 'asc', 'parent' => 0)); $choices['0'] = 'None'; foreach( $pages as $page ){ $choices[$page->ID] = $page->post_title; } return $choices; } //Check and match if the page ancestor matches the value public function acf_location_rules_match_page_ancestor($match, $rule, $options) { $ancestor = get_ancestors($_GET['post'], 'page'); $ancestor = array_reverse($ancestor); $ancestor = array_filter($ancestor); $ancestor = (!empty($ancestor[0]))? $ancestor[0]: null; if( $ancestor ){ if( !empty($rule['param']) and $rule['param'] == 'page_ancestor' and !empty($rule['value']) and $rule['value'] == $ancestor ){ $match = true; } } return $match; } } new acf_page_level;