WP_Customize_Manager::remove_panel() WordPress Method

The WP_Customize_Manager::remove_panel() method is used to remove a panel from the Customizer. This is useful if you want to de-clutter the Customizer interface or if you want to remove a panel that is no longer needed.

WP_Customize_Manager::remove_panel( string $id ) #

Removes a customize panel.


Description

Note that removing the panel doesn’t destroy the WP_Customize_Panel instance or remove its filters.


Top ↑

Parameters

$id

(string)(Required)Panel ID to remove.


Top ↑

Source

File: wp-includes/class-wp-customize-manager.php

	public function remove_panel( $id ) {
		// Removing core components this way is _doing_it_wrong().
		if ( in_array( $id, $this->components, true ) ) {
			_doing_it_wrong(
				__METHOD__,
				sprintf(
					/* translators: 1: Panel ID, 2: Link to 'customize_loaded_components' filter reference. */
					__( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ),
					$id,
					sprintf(
						'<a href="%1$s">%2$s</a>',
						esc_url( '/reference/hooks/customize_loaded_components/' ),
						'<code>customize_loaded_components</code>'
					)
				),
				'4.5.0'
			);
		}
		unset( $this->panels[ $id ] );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More