Skip to content

Instantly share code, notes, and snippets.

@obiPlabon
Created December 11, 2020 10:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save obiPlabon/36efff94fd525ba8bad544d3873d27a3 to your computer and use it in GitHub Desktop.
Save obiPlabon/36efff94fd525ba8bad544d3873d27a3 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;
} );
@obiPlabon
Copy link
Author

The code preview was created using Carbon.now.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment