Issue wih defineing Custom Category in elementor wordpress

Viewed 164

I am Trying to define a custom category for my widgets. I added The following code in the in the widget class.

class widget_one extends \Elementor\Widget_Base{
    public function __construct(){
        add_action( 'elementor/elements/categories_registered', 'add_elementor_widget_categories' );
    }

    function add_elementor_widget_categories( $elements_manager ) {

        $elements_manager->add_category(
            'first-category',
            [
                'title' => __( 'First Category', 'test-add-ons' ),
                'icon' => 'fa fa-plug',
            ]
        );  
    }
    
    public function get_name() {
        return 'oembed';
    }
    public function get_title() {
        return __( 'oEmbed', 'plugin-name' );
    }

    public function get_icon() {
        return 'fa fa-code';
    }

    public function get_categories() {
        return [ 'general' ];
    }
}

it's not giving any error but Category is not showing. Code result

0 Answers
Related