Elementor 开发者文档

title: "Unregistering Controls" post_status: publish comment_status: open taxonomy: category: - elementor-developers-docs post_tag: - Managers - Src - Repos


Unregistering Controls

Developers can remove Elementor controls from the list of registered controls. This is done by hooking to the control manager and unregistering specific controls by passing the control ID.

Unregistering Existing Controls

Developers should use the following code to unregister existing controls:

/**
 * Unregister Elementor controls.
 *
 * @param \Elementor\Controls_Manager $controls_manager Elementor controls manager.
 * @return void
 */
function unregister_controls( $controls_manager ) {

    $controls_manager->unregister( 'control-1' );
    $controls_manager->unregister( 'control-2' );

}
add_action( 'elementor/controls/register', 'unregister_controls' );

This code hooks to the elementor/controls/register action hook which holds the control manager. The manager then unregisters controls by passing the control ID.