2 deleted 6 characters in body
source | link

After digging around inside of some core files, I was actually able to get this resolved.

The following function will retrieve all registered sections in the customizer and loop over each to un-register them altogether.

This should run before registering any of your own custom sections, as to not remove your custom registered sections.

function eherman_remove_registered_customizer_sections() {
    // retrieve the sections array
    $registered_sections = $wp_customize->sections();
    // loop over and remove each section
    foreach( $registered_sections as $section ) {
       $wp_customize->remove_section( $section->id );
    }   
}

Not bad at all. Hopefully that helps others out as we move closer to a more powerful customizer!

Evan

Resources:

WP Customizer Class: https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-customize-manager.php#L401

After digging around inside of some core files, I was actually able to get this resolved.

The following function will retrieve all registered sections in the customizer and loop over each to un-register them altogether.

This should run before registering any of your own custom sections, as to not remove your custom registered sections.

function eherman_remove_registered_customizer_sections() {
    // retrieve the sections array
    $registered_sections = $wp_customize->sections();
    // loop over and remove each section
    foreach( $registered_sections as $section ) {
       $wp_customize->remove_section( $section->id );
    }   
}

Not bad at all. Hopefully that helps others out as we move closer to a more powerful customizer!

Evan

Resources:

WP Customizer Class: https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-customize-manager.php#L401

After digging around inside of some core files, I was actually able to get this resolved.

The following function will retrieve all registered sections in the customizer and loop over each to un-register them altogether.

This should run before registering any of your own custom sections, as to not remove your custom registered sections.

function eherman_remove_registered_customizer_sections() {
    // retrieve the sections array
    $registered_sections = $wp_customize->sections();
    // loop over and remove each section
    foreach( $registered_sections as $section ) {
       $wp_customize->remove_section( $section->id );
    }   
}

Not bad at all. Hopefully that helps others out as we move closer to a more powerful customizer!

Resources:

1
source | link

After digging around inside of some core files, I was actually able to get this resolved.

The following function will retrieve all registered sections in the customizer and loop over each to un-register them altogether.

This should run before registering any of your own custom sections, as to not remove your custom registered sections.

function eherman_remove_registered_customizer_sections() {
    // retrieve the sections array
    $registered_sections = $wp_customize->sections();
    // loop over and remove each section
    foreach( $registered_sections as $section ) {
       $wp_customize->remove_section( $section->id );
    }   
}

Not bad at all. Hopefully that helps others out as we move closer to a more powerful customizer!

Evan

Resources:

WP Customizer Class: https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-customize-manager.php#L401