Unfortunately there doesn’t seem any way to hook into the underlying get_pages
call that the control dropdown-pages
uses, so you’ll have to build your own set of choices (that includes private pages) and use the standard select
control type instead:
if ( ! class_exists( 'WPSE_406789_Walker_Page_Options' ) ) {
class WPSE_406789_Walker_Page_Options extends Walker_Page {
public $choices = [];
public function start_el( &$output, $data_object, $depth = 0, $args = [], $current_object_id = 0 ) {
$pad = str_repeat( ' ', $depth * 3 );
$this->choices[ $data_object->ID ] = $pad . get_the_title( $data_object );
}
}
}
$walker = new WPSE_406789_Walker_Page_Options();
$pages = get_pages([
'post_status' => [
'publish',
'private',
],
]);
$walker->walk( $pages, 0, [], 0 );
$wp_customize->add_control( 'resources_page', [
'type' => 'select',
'choices' => $walker->choices,
'section' => 'key_page_locations',
'label' => 'Resources page',
'description' => 'A page for private resources',
]);
I’ve used a custom walker here so that you still get the
padding that the default wp_dropdown_pages
generates to visualise the page hierarchy.