Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Plugin Name: WP Core #39663: Test case for broken contextual panels and sections.
* Plugin URI: https://core.trac.wordpress.org/ticket/39663
* Author: Weston Ruter, XWP
*/
add_action( 'customize_register', function ( WP_Customize_Manager $wp_customize ) {
$panel = $wp_customize->add_panel( 'test_panel', array(
'title' => '👉 Test Panel 👈',
'active_callback' => 'is_front_page',
'priority' => 90,
) );
for ( $i = 0; $i < 3; $i += 1 ) {
$section = $wp_customize->add_section( "test_panel_section_{$i}", array(
'panel' => $panel->id,
'title' => "Test Panel Section $i",
) );
for ( $j = 0; $j < 3; $j += 1 ) {
$wp_customize->add_control( "test_panel_section_{$i}_control_{$j}", array(
'label' => "Settingless Control $j",
'settings' => array(),
'section' => $section->id,
) );
}
}
$section = $wp_customize->add_section( 'test_root_section', array(
'title' => '👉 Test Root Section 👈',
'priority' => 90,
'active_callback' => 'is_front_page',
) );
$wp_customize->add_control( 'test_root_section_control', array(
'label' => 'Settingless Control',
'settings' => array(),
'section' => $section->id,
) );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.