One neat “feature” introduced in WordPress 4.1 was the removal of the background and header admin screens in favor of the customizer (see ticket). Now if you click to customize one of those items, it links directly to the customizer and opens the appropriate panel.
If your plugin or theme adds customizer options, you can also link to those. Just use:
admin_url( 'customize.php?autofocus[control]=control-name' )
Replace “control-name” with the name of the control you’d like to link to.
Examples
For a new theme I’m building, users need to select pages to use in order to display them on a specific page template.
If they haven’t selected any pages, I display this notice (only for logged in users who have the ability to customize):
<?php if ( current_user_can( 'customize' ) ) { ?> <div class="admin-msg"> <p><?php _e( 'There are no pages available to display.', 'textdomain' ); ?></p> <p><?php printf( __( 'These pages can be set in the <a href="%s">customizer</a>.', 'textdomain' ), admin_url( 'customize.php?autofocus[control]=showcase-tag' ) ); ?></p> </div> <?php }
You can also see how this the background and header links are done in core:
https://core.trac.wordpress.org/ticket/25569
Hi Davin,
awesome explanation of this new awesome feature.
But users needs to change the autofocus[control] in autofocus[section] or autofocus[panel] depends on the control type.
This is not so clear in the snippet above.
Do you know if it’s possible to link to another panel/section/control in Customizer without reloading the page? For instance, a link in a custom control that would redirect you to a control defined by core.