Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save raazon/e65380436acbc08bab18c3507a432f12 to your computer and use it in GitHub Desktop.
Save raazon/e65380436acbc08bab18c3507a432f12 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