Closed stratboy closed 6 years ago
By the way, it should be somewhat easier to hide widgets. Maybe a checkbox list in preferences? Or simply make the widgets lists collapsable (and saving layout prefs)?
You can use $widgets_manager->unregister_widget_type
to remove any Elementor, Elementor Pro or any other 3rd party plugin widgets that are registered (assuming its done correctly), you simply need to make sure are already registered before you remove them.
The Pro widgets are registered on default priority which is 10 so you just make sure you run your hook after that for example with priority of 15:
add_action('elementor/widgets/widgets_registered', function( $widget_manager ){
$widget_manager->unregister_widget_type('form');
}, 15);
Ok done for pro widgets too. Still can't hide the wordpress widgets since I can't find a list of wp widgets names. How to?
@stratboy - This might help. Note however that the function removes all WP Widgets as opposed to individual.
If you know the widget's id_base then you can simply use the same method for Elementor by simply appending the id to the name in place of the variable shown at L42
@norewp - thank you. The following is sample code for removing everything (for now > I suppose in the future there will be some other widgets). To activate the ones needed, just comment out the corresponding array items.
global $elementor_widget_blacklist;
$elementor_widget_blacklist = [
,'common'
,'heading'
,'image'
,'text-editor'
,'video'
,'button'
,'divider'
,'spacer'
,'image-box'
,'google-maps'
,'icon'
,'icon-box'
,'image-gallery'
,'image-carousel'
,'icon-list'
,'counter'
,'progress'
,'testimonial'
,'tabs'
,'accordion'
,'toggle'
,'social-icons'
,'alert'
,'audio'
,'shortcode'
,'html'
,'menu-anchor'
,'sidebar'
// pro ----------------- //
,'posts'
,'portfolio'
,'slides'
,'form'
,'login'
,'media-carousel'
,'testimonial-carousel'
,'nav-menu'
,'pricing'
,'facebook-comment'
,'nav-menu'
,'animated-headline'
,'price-list'
,'price-table'
,'facebook-button'
,'facebook-comments'
,'facebook-embed'
,'facebook-page'
,'add-to-cart'
,'categories'
,'elements'
,'products'
,'flip-box'
,'carousel'
,'countdown'
,'share-buttons'
,'author-box'
,'breadcrumbs'
,'search-form'
,'post-navigation'
,'post-comments'
,'theme-elements'
,'blockquote'
,'template'
,'wp-widget-audio'
,'woocommerce'
,'social'
,'library'
// wp widgets ----------------- //
,'wp-widget-pages'
,'wp-widget-archives'
,'wp-widget-media_audio'
,'wp-widget-media_image'
,'wp-widget-media_gallery'
,'wp-widget-media_video'
,'wp-widget-meta'
,'wp-widget-search'
,'wp-widget-text'
,'wp-widget-categories'
,'wp-widget-recent-posts'
,'wp-widget-recent-comments'
,'wp-widget-rss'
,'wp-widget-tag_cloud'
,'wp-widget-nav_menu'
,'wp-widget-custom_html'
,'wp-widget-polylang'
,'wp-widget-calendar'
,'wp-widget-elementor-library'
];
add_action('elementor/widgets/widgets_registered', function($widgets_manager){
global $elementor_widget_blacklist;
foreach($elementor_widget_blacklist as $widget_name){
$widgets_manager->unregister_widget_type($widget_name);
}
}, 15);
Beside clearer editor, do we have any another benifit from removing widgets? (lighter js, faster...)?
@norewp - thank you. The following is sample code for removing everything (for now > I suppose in the future there will be some other widgets). To activate the ones needed, just comment out the corresponding array items.
Does this stop the corresponding CSS/js etc from loading?
Will this have any performance benefits? I want to remove and dequeue as much as possible.
Where do I add this code?...
Where do I add this code?...
functions.php file of your theme.
@norewp - thank you. The following is sample code for removing everything (for now > I suppose in the future there will be some other widgets). To activate the ones needed, just comment out the corresponding array items.
global $elementor_widget_blacklist; $elementor_widget_blacklist = [ ,'common' ,'heading' ,'image' ,'text-editor' ,'video' ,'button' ,'divider' ,'spacer' ,'image-box' ,'google-maps' ,'icon' ,'icon-box' ,'image-gallery' ,'image-carousel' ,'icon-list' ,'counter' ,'progress' ,'testimonial' ,'tabs' ,'accordion' ,'toggle' ,'social-icons' ,'alert' ,'audio' ,'shortcode' ,'html' ,'menu-anchor' ,'sidebar' // pro ----------------- // ,'posts' ,'portfolio' ,'slides' ,'form' ,'login' ,'media-carousel' ,'testimonial-carousel' ,'nav-menu' ,'pricing' ,'facebook-comment' ,'nav-menu' ,'animated-headline' ,'price-list' ,'price-table' ,'facebook-button' ,'facebook-comments' ,'facebook-embed' ,'facebook-page' ,'add-to-cart' ,'categories' ,'elements' ,'products' ,'flip-box' ,'carousel' ,'countdown' ,'share-buttons' ,'author-box' ,'breadcrumbs' ,'search-form' ,'post-navigation' ,'post-comments' ,'theme-elements' ,'blockquote' ,'template' ,'wp-widget-audio' ,'woocommerce' ,'social' ,'library' // wp widgets ----------------- // ,'wp-widget-pages' ,'wp-widget-archives' ,'wp-widget-media_audio' ,'wp-widget-media_image' ,'wp-widget-media_gallery' ,'wp-widget-media_video' ,'wp-widget-meta' ,'wp-widget-search' ,'wp-widget-text' ,'wp-widget-categories' ,'wp-widget-recent-posts' ,'wp-widget-recent-comments' ,'wp-widget-rss' ,'wp-widget-tag_cloud' ,'wp-widget-nav_menu' ,'wp-widget-custom_html' ,'wp-widget-polylang' ,'wp-widget-calendar' ,'wp-widget-elementor-library' ]; add_action('elementor/widgets/widgets_registered', function($widgets_manager){ global $elementor_widget_blacklist; foreach($elementor_widget_blacklist as $widget_name){ $widgets_manager->unregister_widget_type($widget_name); } }, 15);
I pasted the code in my functions.php file but I got the following error. Am I missing something? Thanks!
@Noeil182 The first line of the $elementor_widget_blacklist array should not start with a coma.
Here ,'common'
should be 'common'
This should work :
global $elementor_widget_blacklist;
$elementor_widget_blacklist = [
'common'
,'heading'
,'image'
,'text-editor'
,'video'
,'button'
,'divider'
,'spacer'
,'image-box'
,'google-maps'
,'icon'
,'icon-box'
,'image-gallery'
,'image-carousel'
,'icon-list'
,'counter'
,'progress'
,'testimonial'
,'tabs'
,'accordion'
,'toggle'
,'social-icons'
,'alert'
,'audio'
,'shortcode'
,'html'
,'menu-anchor'
,'sidebar'
// pro ----------------- //
,'posts'
,'portfolio'
,'slides'
,'form'
,'login'
,'media-carousel'
,'testimonial-carousel'
,'nav-menu'
,'pricing'
,'facebook-comment'
,'nav-menu'
,'animated-headline'
,'price-list'
,'price-table'
,'facebook-button'
,'facebook-comments'
,'facebook-embed'
,'facebook-page'
,'add-to-cart'
,'categories'
,'elements'
,'products'
,'flip-box'
,'carousel'
,'countdown'
,'share-buttons'
,'author-box'
,'breadcrumbs'
,'search-form'
,'post-navigation'
,'post-comments'
,'theme-elements'
,'blockquote'
,'template'
,'wp-widget-audio'
,'woocommerce'
,'social'
,'library'
// wp widgets ----------------- //
,'wp-widget-pages'
,'wp-widget-archives'
,'wp-widget-media_audio'
,'wp-widget-media_image'
,'wp-widget-media_gallery'
,'wp-widget-media_video'
,'wp-widget-meta'
,'wp-widget-search'
,'wp-widget-text'
,'wp-widget-categories'
,'wp-widget-recent-posts'
,'wp-widget-recent-comments'
,'wp-widget-rss'
,'wp-widget-tag_cloud'
,'wp-widget-nav_menu'
,'wp-widget-custom_html'
,'wp-widget-polylang'
,'wp-widget-calendar'
,'wp-widget-elementor-library'
];
add_action('elementor/widgets/widgets_registered', function($widgets_manager){
global $elementor_widget_blacklist;
foreach($elementor_widget_blacklist as $widget_name){
$widgets_manager->unregister_widget_type($widget_name);
}
}, 15);
Thanks for your help!
Hi,
Just checking, should this still work for pro widgets? They still display in the editor panel, and the widget list doesn't appear to contain any of the items in the pro section at the time the action is hit.
the code works for wp- elements only. pro items still appear. are there any changes since v3?
@Noeil182 The first line of the $elementor_widget_blacklist array should not start with a coma.
Here
,'common'
should be'common'
This should work :
global $elementor_widget_blacklist; $elementor_widget_blacklist = [ 'common' ,'heading' ,'image' ,'text-editor' ,'video' ,'button' ,'divider' ,'spacer' ,'image-box' ,'google-maps' ,'icon' ,'icon-box' ,'image-gallery' ,'image-carousel' ,'icon-list' ,'counter' ,'progress' ,'testimonial' ,'tabs' ,'accordion' ,'toggle' ,'social-icons' ,'alert' ,'audio' ,'shortcode' ,'html' ,'menu-anchor' ,'sidebar' // pro ----------------- // ,'posts' ,'portfolio' ,'slides' ,'form' ,'login' ,'media-carousel' ,'testimonial-carousel' ,'nav-menu' ,'pricing' ,'facebook-comment' ,'nav-menu' ,'animated-headline' ,'price-list' ,'price-table' ,'facebook-button' ,'facebook-comments' ,'facebook-embed' ,'facebook-page' ,'add-to-cart' ,'categories' ,'elements' ,'products' ,'flip-box' ,'carousel' ,'countdown' ,'share-buttons' ,'author-box' ,'breadcrumbs' ,'search-form' ,'post-navigation' ,'post-comments' ,'theme-elements' ,'blockquote' ,'template' ,'wp-widget-audio' ,'woocommerce' ,'social' ,'library' // wp widgets ----------------- // ,'wp-widget-pages' ,'wp-widget-archives' ,'wp-widget-media_audio' ,'wp-widget-media_image' ,'wp-widget-media_gallery' ,'wp-widget-media_video' ,'wp-widget-meta' ,'wp-widget-search' ,'wp-widget-text' ,'wp-widget-categories' ,'wp-widget-recent-posts' ,'wp-widget-recent-comments' ,'wp-widget-rss' ,'wp-widget-tag_cloud' ,'wp-widget-nav_menu' ,'wp-widget-custom_html' ,'wp-widget-polylang' ,'wp-widget-calendar' ,'wp-widget-elementor-library' ]; add_action('elementor/widgets/widgets_registered', function($widgets_manager){ global $elementor_widget_blacklist; foreach($elementor_widget_blacklist as $widget_name){ $widgets_manager->unregister_widget_type($widget_name); } }, 15);
Adding this spits out the following error:
Any updates about this? I dont know where to place this within the functions.php file
This is not working
This works for me and apparently you can't unregister everything especially 'common' or it will throw a critical error. Just comment or delete those you want to keep.
add_action('elementor/widgets/widgets_registered', function($widgets_manager){
$widgets_manager->unregister_widget_type('heading'); $widgets_manager->unregister_widget_type('image'); $widgets_manager->unregister_widget_type('text-editor'); $widgets_manager->unregister_widget_type('video'); $widgets_manager->unregister_widget_type('button'); $widgets_manager->unregister_widget_type('divider'); $widgets_manager->unregister_widget_type('spacer'); $widgets_manager->unregister_widget_type('image-box'); $widgets_manager->unregister_widget_type('google-maps'); $widgets_manager->unregister_widget_type('icon'); $widgets_manager->unregister_widget_type('icon-box'); $widgets_manager->unregister_widget_type('image-gallery'); $widgets_manager->unregister_widget_type('image-carousel'); $widgets_manager->unregister_widget_type('icon-list'); $widgets_manager->unregister_widget_type('counter'); $widgets_manager->unregister_widget_type('progress'); $widgets_manager->unregister_widget_type('testimonial'); $widgets_manager->unregister_widget_type('tabs'); $widgets_manager->unregister_widget_type('accordion'); $widgets_manager->unregister_widget_type('toggle'); $widgets_manager->unregister_widget_type('social-icons'); $widgets_manager->unregister_widget_type('alert'); $widgets_manager->unregister_widget_type('audio'); $widgets_manager->unregister_widget_type('shortcode'); $widgets_manager->unregister_widget_type('html'); $widgets_manager->unregister_widget_type('menu-anchor'); $widgets_manager->unregister_widget_type('sidebar');
// pro ----------------- // $widgets_manager->unregister_widget_type('posts'); $widgets_manager->unregister_widget_type('portfolio'); $widgets_manager->unregister_widget_type('slides'); $widgets_manager->unregister_widget_type('form'); $widgets_manager->unregister_widget_type('login'); $widgets_manager->unregister_widget_type('media-carousel'); $widgets_manager->unregister_widget_type('testimonial-carousel'); $widgets_manager->unregister_widget_type('nav-menu'); $widgets_manager->unregister_widget_type('pricing'); $widgets_manager->unregister_widget_type('facebook-comment'); $widgets_manager->unregister_widget_type('nav-menu'); $widgets_manager->unregister_widget_type('animated-headline'); $widgets_manager->unregister_widget_type('price-list'); $widgets_manager->unregister_widget_type('price-table'); $widgets_manager->unregister_widget_type('facebook-button'); $widgets_manager->unregister_widget_type('facebook-comments'); $widgets_manager->unregister_widget_type('facebook-embed'); $widgets_manager->unregister_widget_type('facebook-page'); $widgets_manager->unregister_widget_type('add-to-cart'); $widgets_manager->unregister_widget_type('categories'); $widgets_manager->unregister_widget_type('elements'); $widgets_manager->unregister_widget_type('products'); $widgets_manager->unregister_widget_type('flip-box'); $widgets_manager->unregister_widget_type('carousel'); $widgets_manager->unregister_widget_type('countdown'); $widgets_manager->unregister_widget_type('share-buttons'); $widgets_manager->unregister_widget_type('author-box'); $widgets_manager->unregister_widget_type('breadcrumbs'); $widgets_manager->unregister_widget_type('search-form'); $widgets_manager->unregister_widget_type('post-navigation'); $widgets_manager->unregister_widget_type('post-comments'); $widgets_manager->unregister_widget_type('theme-elements'); $widgets_manager->unregister_widget_type('blockquote'); $widgets_manager->unregister_widget_type('template'); $widgets_manager->unregister_widget_type('wp-widget-audio'); $widgets_manager->unregister_widget_type('woocommerce'); $widgets_manager->unregister_widget_type('social'); $widgets_manager->unregister_widget_type('library');
// wp widgets ----------------- // $widgets_manager->unregister_widget_type('wp-widget-pages'); $widgets_manager->unregister_widget_type('wp-widget-archives'); $widgets_manager->unregister_widget_type('wp-widget-media_audio'); $widgets_manager->unregister_widget_type('wp-widget-media_image'); $widgets_manager->unregister_widget_type('wp-widget-media_gallery'); $widgets_manager->unregister_widget_type('wp-widget-media_video'); $widgets_manager->unregister_widget_type('wp-widget-meta'); $widgets_manager->unregister_widget_type('wp-widget-search'); $widgets_manager->unregister_widget_type('wp-widget-text'); $widgets_manager->unregister_widget_type('wp-widget-categories'); $widgets_manager->unregister_widget_type('wp-widget-recent-posts'); $widgets_manager->unregister_widget_type('wp-widget-recent-comments'); $widgets_manager->unregister_widget_type('wp-widget-rss'); $widgets_manager->unregister_widget_type('wp-widget-tag_cloud'); $widgets_manager->unregister_widget_type('wp-widget-nav_menu'); $widgets_manager->unregister_widget_type('wp-widget-custom_html'); $widgets_manager->unregister_widget_type('wp-widget-polylang'); $widgets_manager->unregister_widget_type('wp-widget-calendar'); $widgets_manager->unregister_widget_type('wp-widget-elementor-library');
}, 15);
This code works great. But found that some woocommerce widgets are not being removed from the wordpress dropdown widget.
is there a way to unregister those as well? Just unregister it from elementor, not totally unregister from wordpress.
Sorry I'm coming late to the party here. What's the best place for this code to help ensure elementor has them registered before they're removed? I'm new to WP code. I added the code above to functions.php but it doesn't do anything because it seems to be too early.
functions.php
function hide_widgets_elementor_pro() { echo '
display: none !important;
}
'; } add_action('admin_init', 'hide_widgets_elementor_pro');
Hi i tried the code above but somehow still cant hide some widgets
Can someone pls help me with this?
thank u so much
@luan0409 The solution I arrived at to hide ALL pro widgets is a variation of what @rafaelhsouza-dev posted above. Here's the code I put in functions.php that worked for me:
add_action('elementor/editor/after_enqueue_styles', function($widgets_manager) { echo '<style>#elementor-panel-category-pro-elements, #elementor-panel-category-theme-elements, #elementor-panel-category-woocommerce-elements, #elementor-panel-get-pro-elements {display:none;}</style>'; } );
If it doesn't work also for you, then it likely means the "selectors" for the elementor widgets is different (the items starting with #elementor-panel-category.... above). In that case you'll need to use the browser's inspector development tool to examine the selectors for the widgets you want to hide. This is also how you can hide some widgets and not others.
Reading this issue thread helped me solve my problem, But I'm looking for a solution to a specific problem,
add_action('elementor/editor/after_enqueue_styles', function($widgets_manager) { echo ''; } );
You can also add the "Get Pro" notice with the following addition:
//Disable ALL Elementor Pro widgets add_action('elementor/editor/after_enqueue_styles', function($widgets_manager) { echo ''; } );
This works for me and apparently you can't unregister everything especially 'common' or it will throw a critical error. Just comment or delete those you want to keep.
add_action('elementor/widgets/widgets_registered', function($widgets_manager){
$widgets_manager->unregister_widget_type('heading'); $widgets_manager->unregister_widget_type('image'); $widgets_manager->unregister_widget_type('text-editor'); $widgets_manager->unregister_widget_type('video'); $widgets_manager->unregister_widget_type('button'); $widgets_manager->unregister_widget_type('divider'); $widgets_manager->unregister_widget_type('spacer'); $widgets_manager->unregister_widget_type('image-box'); $widgets_manager->unregister_widget_type('google-maps'); $widgets_manager->unregister_widget_type('icon'); $widgets_manager->unregister_widget_type('icon-box'); $widgets_manager->unregister_widget_type('image-gallery'); $widgets_manager->unregister_widget_type('image-carousel'); $widgets_manager->unregister_widget_type('icon-list'); $widgets_manager->unregister_widget_type('counter'); $widgets_manager->unregister_widget_type('progress'); $widgets_manager->unregister_widget_type('testimonial'); $widgets_manager->unregister_widget_type('tabs'); $widgets_manager->unregister_widget_type('accordion'); $widgets_manager->unregister_widget_type('toggle'); $widgets_manager->unregister_widget_type('social-icons'); $widgets_manager->unregister_widget_type('alert'); $widgets_manager->unregister_widget_type('audio'); $widgets_manager->unregister_widget_type('shortcode'); $widgets_manager->unregister_widget_type('html'); $widgets_manager->unregister_widget_type('menu-anchor'); $widgets_manager->unregister_widget_type('sidebar');
// pro ----------------- // $widgets_manager->unregister_widget_type('posts'); $widgets_manager->unregister_widget_type('portfolio'); $widgets_manager->unregister_widget_type('slides'); $widgets_manager->unregister_widget_type('form'); $widgets_manager->unregister_widget_type('login'); $widgets_manager->unregister_widget_type('media-carousel'); $widgets_manager->unregister_widget_type('testimonial-carousel'); $widgets_manager->unregister_widget_type('nav-menu'); $widgets_manager->unregister_widget_type('pricing'); $widgets_manager->unregister_widget_type('facebook-comment'); $widgets_manager->unregister_widget_type('nav-menu'); $widgets_manager->unregister_widget_type('animated-headline'); $widgets_manager->unregister_widget_type('price-list'); $widgets_manager->unregister_widget_type('price-table'); $widgets_manager->unregister_widget_type('facebook-button'); $widgets_manager->unregister_widget_type('facebook-comments'); $widgets_manager->unregister_widget_type('facebook-embed'); $widgets_manager->unregister_widget_type('facebook-page'); $widgets_manager->unregister_widget_type('add-to-cart'); $widgets_manager->unregister_widget_type('categories'); $widgets_manager->unregister_widget_type('elements'); $widgets_manager->unregister_widget_type('products'); $widgets_manager->unregister_widget_type('flip-box'); $widgets_manager->unregister_widget_type('carousel'); $widgets_manager->unregister_widget_type('countdown'); $widgets_manager->unregister_widget_type('share-buttons'); $widgets_manager->unregister_widget_type('author-box'); $widgets_manager->unregister_widget_type('breadcrumbs'); $widgets_manager->unregister_widget_type('search-form'); $widgets_manager->unregister_widget_type('post-navigation'); $widgets_manager->unregister_widget_type('post-comments'); $widgets_manager->unregister_widget_type('theme-elements'); $widgets_manager->unregister_widget_type('blockquote'); $widgets_manager->unregister_widget_type('template'); $widgets_manager->unregister_widget_type('wp-widget-audio'); $widgets_manager->unregister_widget_type('woocommerce'); $widgets_manager->unregister_widget_type('social'); $widgets_manager->unregister_widget_type('library');
// wp widgets ----------------- // $widgets_manager->unregister_widget_type('wp-widget-pages'); $widgets_manager->unregister_widget_type('wp-widget-archives'); $widgets_manager->unregister_widget_type('wp-widget-media_audio'); $widgets_manager->unregister_widget_type('wp-widget-media_image'); $widgets_manager->unregister_widget_type('wp-widget-media_gallery'); $widgets_manager->unregister_widget_type('wp-widget-media_video'); $widgets_manager->unregister_widget_type('wp-widget-meta'); $widgets_manager->unregister_widget_type('wp-widget-search'); $widgets_manager->unregister_widget_type('wp-widget-text'); $widgets_manager->unregister_widget_type('wp-widget-categories'); $widgets_manager->unregister_widget_type('wp-widget-recent-posts'); $widgets_manager->unregister_widget_type('wp-widget-recent-comments'); $widgets_manager->unregister_widget_type('wp-widget-rss'); $widgets_manager->unregister_widget_type('wp-widget-tag_cloud'); $widgets_manager->unregister_widget_type('wp-widget-nav_menu'); $widgets_manager->unregister_widget_type('wp-widget-custom_html'); $widgets_manager->unregister_widget_type('wp-widget-polylang'); $widgets_manager->unregister_widget_type('wp-widget-calendar'); $widgets_manager->unregister_widget_type('wp-widget-elementor-library');
}, 15);
this one work only for free widget now, the pro widget still showing. any idea???
Good look //hide widgets pro elementor function remove_widgets_elementor_pro() { echo "
";
} add_action( 'elementor/widgets/widgets_registered', 'remove_widgets_elementor_pro' );
Good look //hide widgets pro elementor function remove_widgets_elementor_pro() { echo " "; } add_action( 'elementor/widgets/widgets_registered', 'remove_widgets_elementor_pro' );
it's not a good solution because the widget show when we use search
Any ideas how to remove the "add template" (.elementor-add-section-area-button elementor-add-template-button) button from the editor?
Not sure if still relevant, but I was struggling to disable the Elementor Pro widgets. I've found instead of using the hook 'elementor/widgets/widgets_registered' using the hook 'elementor/widgets/register' works. So my code looked like this:
global $elementor_widget_blacklist;
$elementor_widget_blacklist = [
'... array of elements/widgets you want to disable'
];
add_action('elementor/widgets/register', function($widgets_manager){
global $elementor_widget_blacklist;
// uncomment to list all registered widgets, for debuging only
// foreach($widgets_manager->get_widget_types() as $name => $widget) {
// var_dump($name);
// echo '<br>';
// }
foreach($elementor_widget_blacklist as $widget_name){
$widgets_manager->unregister($widget_name);
}
}, 99);
If you are not sure what the name/slug of the widget is you can uncomment the $widgets_manager->get_widget_types() loop and then simply load your home page to see them all listed.
And if you want to simply hide the widgets/elements from the side panel in the elementor editor, but still want the widget to work on the site you can use:
add_filter( 'elementor/editor/localize_settings', function( $settings ) {
global $elementor_widget_blacklist;
// uncomment to list all registered widgets, for debuging only
// foreach ($settings['initial_document']['widgets'] as $key => $setting) {
// var_dump($key);
// }
foreach($elementor_widget_blacklist as $widget_name){
$settings['initial_document']['widgets'][$widget_name]['show_in_panel'] = false;
}
return $settings;
}, 99 );
I think this seems to work for hiding promotional (pro) widgets too, if you don't have the pro version. Also works for the Essential add on plugin.
All the solutions here didn't work for me. The only working solution was the CSS. Here a functional code in 2023:
add_action('elementor/editor/wp_head', function () {
echo '
<style>
#elementor-panel-category-pro-elements,
#elementor-panel-category-theme-elements,
#elementor-panel-category-theme-elements-single,
#elementor-panel-category-woocommerce-elements {
display: none;
}
</style>';
}, 100);
Since the PRO widgets are generated by JavaScript and not registered directly by Elementor, there is no more possible to disable them in PHP. The only solution is to hide the panels.
@Auraylien thank you
This is still the best solution, unfortunately :(
add_action('elementor/editor/wp_head', function () { echo '<style> #elementor-panel-category-pro-elements, #elementor-panel-category-theme-elements, #elementor-panel-category-theme-elements-single, #elementor-panel-category-woocommerce-elements { display: none; }</style>'; }, 99);
Hi, I would like to clean up the editor since most of the time we use just the 10% of all widgets.
I learned how to unregister default Elementor widgets with
$widgets_manager->unregister_widget_type
, but it seems it doesn't work for Elementor Pro widgets: they seem to be 'modules' rather than 'widgets'.How to?