I'm working with Customizer's it's really powerful. I'd like to extend it, so instead of editing only the main page, I want to allow editing of inner pages.

Does anybody have the solution?
Below code to show drop-down pages. when I select any page it refreshes but doesn't load the page.

$wp_customize->add_setting( 'themeslug_dropdownpages_setting_id', array(
  'capability' => 'edit_theme_options',
  'sanitize_callback' => 'themeslug_sanitize_dropdown_pages',
) );

$wp_customize->add_control( 'themeslug_dropdownpages_setting_id', array(
  'type' => 'dropdown-pages',
  'section' => 'custom_section', // Add a default or your own section
  'label' => __( 'Custom Dropdown Pages' ),
  'description' => __( 'This is a custom dropdown pages option.' ),
) );

function themeslug_sanitize_dropdown_pages( $page_id, $setting ) {
  // Ensure $input is an absolute integer.
  $page_id = absint( $page_id );

  // If $page_id is an ID of a published page, return it; otherwise, return the default.
  return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default );


  • I'm not sure I entirely understand the question. The customizer can be used to preview changes on all pages. The editor is used to edit the page contents. – Matthew Brown aka Lord Matt Dec 24 '20 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.