Skip to content

Instantly share code, notes, and snippets.

@mrcodefinger
Created October 18, 2019 13:01
Show Gist options
  • Save mrcodefinger/53e2bda9edca2fca757bea2966b233c9 to your computer and use it in GitHub Desktop.
Save mrcodefinger/53e2bda9edca2fca757bea2966b233c9 to your computer and use it in GitHub Desktop.
Elementor hide widgets by black list
/**
* With this code it is possible to hide unnecessary widgets of the elementor plugin for wordpress.
* Comment in or out relevant values in array.
*/
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',
'gallery',
'reviews',
'call-to-action',
// general widgets ------------- //
'star-rating',
'sidebar',
'toggle',
'accordion',
'read-more',
'tabs',
'image-box',
// website widgets ------------ //
'sitemap',
// 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) {
foreach($this->widgetBlackListArray() as $widget_name){
$widgets_manager->unregister_widget_type($widget_name);
}
}, 15);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment