Skip to content

Instantly share code, notes, and snippets.

@wppunk
Created July 21, 2021 07:48
Show Gist options
  • Save wppunk/78b5622853239ba75a106ea60235e95e to your computer and use it in GitHub Desktop.
Save wppunk/78b5622853239ba75a106ea60235e95e to your computer and use it in GitHub Desktop.
Deregister Elementor widgets
add_action( 'elementor/widgets/widgets_registered', 'deregister_widgets', 10000 );
/**
* Deregister widgets.
*
* @since 1.0.0
*
* @param Widgets_Manager $widgets_manager Widget manager.
*/
function deregister_widgets( Widgets_Manager $widgets_manager ): void {
foreach (
[
'accordion',
'alert',
'animated-headline',
'archive-posts',
'audio',
'author-box',
'blockquote',
'button',
'call-to-action',
'code-highlight',
'countdown',
'counter',
'divider',
'facebook-button',
'facebook-comments',
'facebook-embed',
'facebook-page',
'flip-box',
'form',
'gallery',
'global',
'google_maps',
'heading',
'hotspot',
'html',
'icon',
'icon-box',
'icon-list',
'image',
'image-box',
'image-carousel',
'image-gallery',
'login',
'lottie',
'media-carousel',
'menu-anchor',
'nav-menu',
'paypal-button',
'portfolio',
'post-comments',
'post-info',
'post-navigation',
'posts',
'price-list',
'price-table',
'progress',
'read-more',
'reviews',
'search-form',
'share-buttons',
'shortcode',
'sidebar',
'sitemap',
'slides',
'social-icons',
'spacer',
'star-rating',
'table-of-contents',
'tabs',
'template',
'testimonial',
'testimonial-carousel',
'text-path',
'theme-archive-title',
'theme-page-title',
'theme-post-content',
'theme-post-excerpt',
'theme-post-featured-image',
'theme-post-title',
'theme-site-logo',
'theme-site-title',
'toggle',
'video',
'video-playlist',
'wp-widget-anycomment-comment-list',
'wp-widget-archives',
'wp-widget-author',
'wp-widget-calendar',
'wp-widget-categories',
'wp-widget-custom_html',
'wp-widget-icl_lang_sel_widget',
'wp-widget-lpwtoc_widget',
'wp-widget-media_audio',
'wp-widget-media_gallery',
'wp-widget-media_image',
'wp-widget-media_video',
'wp-widget-meta',
'wp-widget-nav_menu',
'wp-widget-pages',
'wp-widget-recent-comments',
'wp-widget-recent-posts',
'wp-widget-rss',
'wp-widget-search',
'wp-widget-share',
'wp-widget-tag_cloud',
'wp-widget-text',
'wp-widget-text_icl',
'wpml-language-switcher',
] as $widget
) {
$widgets_manager->unregister_widget_type( $widget );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment