Forked from obiPlabon/elementor-assign-category-snippet.php
Created
December 12, 2020 17:49
-
-
Save raazon/e65380436acbc08bab18c3507a432f12 to your computer and use it in GitHub Desktop.
Asssign any elementor widget to a different category
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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