Created
September 11, 2019 06:48
-
-
Save deckerweb/11878962da6f4e31877520e199254cef to your computer and use it in GitHub Desktop.
For Elementor Page Builder Plugin: Remove the regular WordPress Widgets from the left-hand Panel in the Live Editor. --- CAUTION: Use at your own risk! No support here!!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Do NOT include the opening php tag */ | |
if ( ! function_exists( 'ddw_tweak_elementor_remove_wp_widgets' ) ) : | |
add_filter( 'elementor/widgets/black_list', 'ddw_tweak_elementor_remove_wp_widgets' ); | |
/** | |
* Optionally remove all WordPress widgets from the Elementor Live Editor. | |
* Note: A native Elementor filter is used. | |
* | |
* @link https://gist.github.com/deckerweb/11878962da6f4e31877520e199254cef | |
* @author David Decker - DECKERWEB | |
* | |
* @global array $GLOBALS[ 'wp_widget_factory' ] | |
* | |
* @param array $black_list Array holding all blacklisted WordPress widgets. | |
* @return array Tweaked array of black listed WordPress widgets. | |
*/ | |
function ddw_tweak_elementor_remove_wp_widgets( $black_list ) { | |
/** Bail early if Elementor not active or tweak not wanted */ | |
if ( ! defined( 'ELEMENTOR_VERSION' ) ) { | |
return $black_list; | |
} | |
/** | |
* Get all registered WordPress widgets, but only the classes | |
* (= the first-level array keys) | |
*/ | |
$black_list = array_keys( $GLOBALS[ 'wp_widget_factory' ]->widgets ); | |
/** Return black list array for filter */ | |
return (array) $black_list; | |
} // end function | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I did it, sorry: