I've got a site with a few extra Customizer sections. Is there a way to link directly to these so that section open when the page loads?

Something like http://mysites.com/wp-admin/customize.php#fonts

screenshot http://new.tinygrab.com/96412a96d208cf8ff0cf5803327b2d29e0ca68810e.png

up vote 13 down vote accepted

As you've already discovered, links to the customizer always start with /wp-admin/customize.php.

Append ?autofocus[section] =section_name to checkout your section within the customizer. Both parameters (section and section_name) are registered within your customize_register hook:

$wp_customize->add_section

If you can't find the hook, check the HTML markup of the customizer for further information. Both parameters are included within the list:

<li id="accordion-section-title_tagline" class="accordion-section control-section control-section-default">

Altogether your link may look something like this:

admin_url( '/customize.php?autofocus[section]=section_name' );

These are the links to the default customizer sections in Twenty Sixteen WordPress theme:

  • Site Identity: /customize.php?autofocus[section]=title_tagline
  • Colors: /customize.php?autofocus[section]=colors
  • Header Image: /customize.php?autofocus[section]=header_image
  • Background Image: /customize.php?autofocus[section]=background_image
  • Menus: /customize.php?autofocus[panel]=nav_menus
  • Widgets: /customize.php?autofocus[panel]=widgets
  • Static Front Page: /customize.php?autofocus[section]=static_front_page

Where to go from this?

I often find myself in need of a menu item from Appearance within the WordPress admin menu. So maybe this will be helpful for you, too:

add_action( 'admin_menu', 'wpse_custom_submenu_page' );
function wpse_custom_submenu_page() {
  add_submenu_page(
    'themes.php',
        __( 'Page title', 'textdomain' ),
        __( 'Menu title', 'textdomain' ),
        'manage_options',
        '/customize.php?autofocus[section]=section_name'
    );
}
  • 2
    This is a good overview +1. – birgire Jan 14 '16 at 8:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.