Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasinhayder/7f93ec8e7fd2d7b0556f567506c22ce7 to your computer and use it in GitHub Desktop.
Save hasinhayder/7f93ec8e7fd2d7b0556f567506c22ce7 to your computer and use it in GitHub Desktop.
Asssign any elementor widget to a different category
<?php
/**
* Asssign any elementor widget to a different category
*
* To override the existing category just pass [ 'your-custom-category' ]
* And to keep existing [ 'your-custom-category', 'basic' ]
* here 'your-custom-category' is any registered category slug
*
* @param array $config
*
* @author obiPlabon <https://obiplabon.im>
*/
add_filter( 'elementor/document/config', function ( $config ) {
// 'text-editor' is the Text Editor widget
// 'heading' is the Heading widget
// @see get_name method in widget class
$config['widgets']['text-editor']['categories'] = [ 'your-custom-category' ];
return $config;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment