Remove a customize control.
public remove_control ( string $id ) | ||
$id | string | ID of the control. |
function remove_example_control( $wp_customize ) { $wp_customize->remove_control( 'example_control' ); } add_action( 'customize_register', 'remove_example_control', 20 );
function remove_control_from_section( $wp_customize ) { $wp_customize->get_section( 'section_id' )->remove_control( 'control_id' ); } add_action( 'customize_register', 'remove_control_from_section', 20 );In both examples, `customize_register` action is used to call the function that removes the control. The `remove_control()` method takes the control ID as its only parameter. The `remove_control()` method is part of the WordPress core, and belongs to the `WP_Customize_Manager` class.
public remove_control ( string $id ) | ||
$id | string | ID of the control. |