How to Create a Custom Elementor Addon Plugin

Summarize this post with AI

A 19-minute read, or the key points in about 30 seconds, in the assistant you already use.

Opens in a new tab with the prompt filled in. Nothing passes through this site.

A custom Elementor addon is just a normal WordPress plugin that registers one or more widget classes extending Elementor's Widget_Base, hooked in through the elementor/widgets/register action. Once you understand that one sentence, the rest is structure. In this guide I'll build a working custom widget from an empty folder, using the current Elementor API — not the deprecated calls most tutorials still copy-paste.

I build these for clients when an off-the-shelf widget doesn't quite fit, or when bundling third-party addons would bloat the site. A focused, hand-built widget loads only what it needs. Here's the whole process, with real code you can run.

What is an Elementor addon, and why build your own?

An Elementor addon adds new widgets (and sometimes controls, dynamic tags, or finishers) to the Elementor editor. Popular suites like Essential Addons or Crocoblock are just large collections of these widgets in one plugin. Building your own means you ship exactly one widget instead of importing a library of 80 you'll never use.

The reasons I go custom on client work are consistent: performance (no loading scripts for widgets you don't use), a pixel-perfect component the client's brand needs, or a widget that pulls from a custom data source. If you only need a slightly different button, custom CSS is enough — but the moment you want a reusable, drag-and-drop element with its own controls, you want a real widget.

What you need before you start

This is a developer task, so a little setup goes a long way. You do not need Elementor Pro to build widgets — the free version exposes the full widget API.

  • A local WordPress install (Local, DevKinsta, or wp-env) so you can break things safely.
  • Elementor (free) active. Pro is optional and not required for custom widgets.
  • Basic PHP and object-oriented (class) familiarity.
  • A code editor and the ability to create folders in wp-content/plugins.

Step 1: Set up the plugin folder and main file

Every addon starts as a standard plugin. Create a folder and a main PHP file inside wp-content/plugins:

code
my-elementor-addon/
├── my-elementor-addon.php      (main plugin file)
├── widgets/
│   └── class-heading-widget.php
└── assets/
    ├── css/addon.css
    └── js/addon.js

The main file just needs the plugin header and a bootstrap. Start with the header:

php
<?php
/**
 * Plugin Name: My Elementor Addon
 * Description: A custom widget addon for Elementor.
 * Version:     1.0.0
 * Author:      Lokesh Kapoor
 * Text Domain: my-elementor-addon
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Never allow direct file access.
}

Step 2: Bootstrap safely (only run when Elementor is active)

The most common way a custom addon white-screens a site is assuming Elementor is loaded when it isn't. Always guard for it. Check on plugins_loaded, and bail with an admin notice if Elementor is missing.

php
add_action( 'plugins_loaded', function () {
    // If Elementor isn't active, show a notice and stop.
    if ( ! did_action( 'elementor/loaded' ) ) {
        add_action( 'admin_notices', function () {
            echo '<div class="notice notice-warning"><p>'
               . esc_html__( 'My Elementor Addon requires Elementor to be active.', 'my-elementor-addon' )
               . '</p></div>';
        } );
        return;
    }

    // Elementor is here — wire up the addon.
    require_once __DIR__ . '/widgets/class-heading-widget.php';
} );

Step 3: Register a custom widget category

A category is the section your widget appears under in the editor panel. It's optional, but a branded category makes your widgets easy to find. Register it on elementor/elements/categories_registered.

php
add_action( 'elementor/elements/categories_registered', function ( $elements_manager ) {
    $elements_manager->add_category(
        'my-addon', // category slug — used in the widget's get_categories()
        [
            'title' => esc_html__( 'My Addon', 'my-elementor-addon' ),
            'icon'  => 'fa fa-plug',
        ]
    );
} );

Step 4: Register your widget

Here's the part that trips people up. The old way — the elementor/widgets/widgets_registered hook and register_widget_type() — was deprecated in Elementor 3.5. If you copy a 2021 tutorial, your widget may throw deprecation notices or stop registering. The current API is the elementor/widgets/register action and the register() method.

php
add_action( 'elementor/widgets/register', function ( $widgets_manager ) {
    $widgets_manager->register( new \My_Elementor_Addon\Heading_Widget() );
} );

Step 5: Build the widget class

This is the heart of the addon. The class extends \Elementor\Widget_Base and implements a handful of methods. Create widgets/class-heading-widget.php.

The identity methods

These tell Elementor what your widget is called, which icon to show, and where it lives.

php
<?php
namespace My_Elementor_Addon;

if ( ! defined( 'ABSPATH' ) ) { exit; }

class Heading_Widget extends \Elementor\Widget_Base {

    public function get_name() {
        return 'my-heading'; // unique machine name
    }

    public function get_title() {
        return esc_html__( 'My Heading', 'my-elementor-addon' );
    }

    public function get_icon() {
        return 'eicon-t-letter'; // any Elementor "eicon-" class
    }

    public function get_categories() {
        return [ 'my-addon' ]; // the category from Step 3
    }

    public function get_keywords() {
        return [ 'heading', 'title', 'text' ]; // search terms in the panel
    }

Adding controls (the Content tab)

Controls are the fields the user edits — text inputs, color pickers, sliders, toggles. You add them inside register_controls(), grouped into sections. Each section is pinned to a tab (Content or Style).

php
    protected function register_controls() {

        // ---- CONTENT TAB ----
        $this->start_controls_section(
            'content_section',
            [
                'label' => esc_html__( 'Content', 'my-elementor-addon' ),
                'tab'   => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'heading_text',
            [
                'label'       => esc_html__( 'Heading', 'my-elementor-addon' ),
                'type'        => \Elementor\Controls_Manager::TEXT,
                'default'     => esc_html__( 'Your heading here', 'my-elementor-addon' ),
                'placeholder' => esc_html__( 'Type your text', 'my-elementor-addon' ),
            ]
        );

        $this->add_responsive_control(
            'align',
            [
                'label'     => esc_html__( 'Alignment', 'my-elementor-addon' ),
                'type'      => \Elementor\Controls_Manager::CHOOSE,
                'options'   => [
                    'left'   => [ 'title' => 'Left',   'icon' => 'eicon-text-align-left' ],
                    'center' => [ 'title' => 'Center', 'icon' => 'eicon-text-align-center' ],
                    'right'  => [ 'title' => 'Right',  'icon' => 'eicon-text-align-right' ],
                ],
                'selectors' => [ '{{WRAPPER}} .my-heading' => 'text-align: {{VALUE}};' ],
            ]
        );

        $this->end_controls_section();

Adding style controls (the Style tab)

Style controls write CSS directly via selectors — no PHP runs on the front end for them. The {{WRAPPER}} token is replaced with the widget's unique selector, so styles never leak. Group controls (like Typography) bundle many fields at once.

php
        // ---- STYLE TAB ----
        $this->start_controls_section(
            'style_section',
            [
                'label' => esc_html__( 'Style', 'my-elementor-addon' ),
                'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
            ]
        );

        $this->add_control(
            'text_color',
            [
                'label'     => esc_html__( 'Text Color', 'my-elementor-addon' ),
                'type'      => \Elementor\Controls_Manager::COLOR,
                'selectors' => [ '{{WRAPPER}} .my-heading' => 'color: {{VALUE}};' ],
            ]
        );

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name'     => 'typography',
                'selector' => '{{WRAPPER}} .my-heading',
            ]
        );

        $this->end_controls_section();
    }

The render method

render() is what outputs the widget on the live page. Always pull values with get_settings_for_display() and escape every dynamic value. Using add_inline_editing_attributes() lets the client edit the text directly on the canvas.

php
    protected function render() {
        $settings = $this->get_settings_for_display();

        $this->add_render_attribute( 'heading', 'class', 'my-heading' );
        $this->add_inline_editing_attributes( 'heading', 'none' );

        echo '<h2 ' . $this->get_render_attribute_string( 'heading' ) . '>'
           . esc_html( $settings['heading_text'] )
           . '</h2>';
    }
}

That's a complete, registrable widget. Activate the plugin, open Elementor, and you'll find "My Heading" under the "My Addon" category.

Step 6: Enqueue your CSS and JavaScript

If your widget needs its own styles or scripts, register them with Elementor's enqueue hooks so they load in both the editor and the front end.

php
add_action( 'elementor/frontend/after_enqueue_styles', function () {
    wp_enqueue_style(
        'my-addon',
        plugins_url( 'assets/css/addon.css', __FILE__ ),
        [],
        '1.0.0'
    );
} );

For widgets with interactive JavaScript, hook elementor/frontend/after_register_scripts to register, then call $this->get_script_depends() in the widget to load it only where used — that conditional loading is the whole performance advantage of a custom addon.

Step 7: Test it in the editor

Activate the plugin, edit any page with Elementor, search "My Heading," and drag it in. Check three things: the Content controls update the text live, the Style controls change color and typography, and the widget renders correctly on the published page (not just in the editor). Toggle responsive alignment to confirm the responsive control works per device.

Code it yourself or use an addon suite?

Hand-coding is the right call for a focused, performance-critical widget. But if you need dozens of dynamic widgets — listings, filters, forms — building them all by hand is a poor use of time. A suite gives you those ready-made.

ApproachBest forTrade-off
Custom-coded widgetOne or two focused, lightweight widgetsYou maintain the code
Addon suite (Crocoblock, etc.)Dynamic listings, filters, many widgets fastMore weight; be selective
Free addon packQuick generic extrasBloat and quality vary

For dynamic, data-driven widgets without writing PHP, Crocoblock's JetEngine is what I reach for — it covers custom post types, listings and filters visually.

And if you want the full theme-builder and premium widget library alongside your custom code, Elementor Pro is the upgrade.

Best practices I follow on client addons

  • Namespace everything (or prefix function and class names) so your addon never collides with another plugin.
  • Escape every output (esc_html, esc_attr, esc_url) — Elementor controls are user input.
  • Use {{WRAPPER}} in selectors so styles are scoped to the widget instance.
  • Load assets conditionally with get_style_depends() / get_script_depends(), never globally.
  • Use add_responsive_control() for anything that should change per device.

Common mistakes (and the deprecation that breaks old tutorials)

  • Using the deprecated register_widget_type() / widgets_registered hook on Elementor 3.5+. Use register() on elementor/widgets/register.
  • Not guarding for Elementor being inactive — a fatal error on activation.
  • Forgetting get_name() must be unique across every widget on the site.
  • Echoing unescaped settings in render() — a real security hole.
  • Hardcoding CSS in render() instead of using selectors, which breaks the editor's live preview.

Frequently asked questions

Do I need Elementor Pro to build a custom addon?▾
No. The free version of Elementor exposes the full widget API. Pro adds premium widgets, the Theme Builder, and dynamic tags, but custom widget development works entirely on free Elementor.
Why isn't my custom widget showing in the editor?▾
The usual cause is the registration hook. On Elementor 3.5+ you must use the elementor/widgets/register action with $widgets_manager->register(), not the deprecated register_widget_type(). Also confirm get_name() is unique and the file is actually being required.
Can I add custom CSS and JavaScript to my widget?▾
Yes. Enqueue styles on elementor/frontend/after_enqueue_styles, and for scripts use get_script_depends() in the widget so the JavaScript only loads on pages where the widget is used.
What's the difference between render() and content_template()?▾
render() outputs the widget with PHP on the front end. content_template() is an optional JavaScript (Underscore) template that renders a live preview inside the editor without a server round-trip. For simple widgets, render() alone is fine.
Is it better to build a widget or buy an addon pack?▾
Build when you need one or two focused, lightweight widgets you control. Buy a suite when you need many dynamic widgets fast and don't want to maintain the code. The honest answer is usually a mix: a suite for the heavy lifting, a small custom addon for the brand-specific pieces.

Wrapping up

A custom Elementor addon is far less intimidating than it looks: a guarded bootstrap, a widget class extending Widget_Base, controls in register_controls(), and output in render(). Get that skeleton working once and every future widget is a variation on it. The big gotcha to remember is the registration API — use the modern register() hook and you'll skip the problem that stalls most beginners.

Want related reading on getting the most from the builder itself?

If you'd rather have a custom widget or full addon built for your brand, that's something I do for clients:

Share