Master Addons
  • Widgets
    • Changelogs
      Source Code NEW PRO
      Caldera Forms
      Logo Slider
      Table of Contents
      Gravity Forms
      Transforms PRO
      Restrict Content PRO
      Pricing Table
      Ninja Form
      Mailchimp
      Tooltip
      Popup Trigger NEW PRO
      Which Element NEW
      Creative Button
      Creative Links NEW
      Domain Search HOT PRO
      Dual Heading HOT
      Flipbox
      Animated Gradient BG HOT PRO
      Image Hotspot PRO
      Infobox
      News Ticker PRO
      Particles
      Progress Bar
      Off-Canvas Content NEW PRO
      Reading Progress Bar HOT
      Custom JS
      Blockquote
      Counter Up
      Image Hover Effects
      Reveal NEW PRO
      Rellax PRO
      Positioning
      Image Comparison
      Tabs
      Toggle Content HOT PRO
      Post/Page Duplicator FREE
      Floating Effects PRO
      Mega Menu HOT
      Custom CSS HOT
      Gradient Headline
      Advanced Image
      Nav Menu
      Tooltips
      Comparison Table PRO
      Glassmorphism
      Featured Product PRO
      Image Carouse
      Gallery Slider NEW PRO
      Dynamic Tags NEW
      Countdown Timer
      Current Time
      Patterns
      Wrapper Link
      Timeline
      Team Member
      Contact Form 7
      Advanced Accordion
      Animated Headlines
      Blog
      Business Hours
      Call To Action
      Progress Bars
      Background Slider
      Team Slider
      Dynamic Table
      Grid Line PRO
      WP Forms
      Search
      We Form
      Entrance Animation NEW PRO
      Display Conditions PRO
      Filterable Image Gallery
      WP Forms
      Custom Breakpoints NEW
  • Features
    • Theme Builder

      Design site-wide templates for a consistent look across every page of your website.

      Popup Builder

      Create engaging popups, modals, and announcement bars - to capture leads.

      Widget Builder

      Expand Elementor with advanced custom widgets to build more dynamic layouts.

      Mega Menu Builder

      Create multi-column menus with icons and images for superior navigation.

      Custom Css

      Apply your own CSS for pixel-perfect styling beyond default design options.

      Dynamic Tags

      Insert dynamic content like post titles and custom fields directly into designs.

      Display Conditions

      Control element visibility based on user role, device, time, and other rules.

      Icons Library

      Choose from thousands of built-in icons to enhance visuals and consistency.

      Animation

      Add scroll, hover, entrance, and much more animations to bring designs to life.
  • Template Kits
    • Template Kits

      Professionally designed full-page template Kit. Import and customize in seconds.

      Ready Sections

      Pre-built content sections and rows. Drag, drop, and customize instantly.

      Ready Popups

      Different types of High-converting popup designs. Import and launch quickly.

      Ready Pages

      Complete page layouts for any purpose. Start editing immediately.

      Ready Header

      Multiple modern header designs. Import and adapt to your brand.

      Ready Footer

      Fully designed footers for different websites. Add functionality and style in clicks.
  • Brands
    • WP Adminify

      WP Adminify

      Take control of your WordPress dashboard. Customize the admin experience.
      Admin Bar Editor

      Admin Bar Editor

      Customize the WordPress admin bar for a cleaner, more personalized workspace.
      Loginfy

      Loginfy

      Customize your WordPress login page with branding, styles, and security enhancements.

      Rolemaster Suite

      Manage user roles and permissions with precision for better security and workflow.
      Master Blocks

      Master Blocks

      Expand the Gutenberg editor with advanced custom blocks for more creative layouts.
      WP Spotlight

      WP Spotlight

      Instantly search and access admin features, posts, and settings from anywhere.
  • Themes
  • Help
    • Get Support
    • Documentation
    • Facebook Community
    • Changelogs
  • Blog
Pricing
🇺🇸EN
  • 🇺🇸EN
  • 🇸🇦AR
  • 🇧🇩BN
  • 🇩🇰DA
  • 🇩🇪DE
  • 🇪🇸ES
  • 🇫🇷FR
  • 🇮🇳HI
  • 🇰🇷KO
  • 🇵🇹PT
  • 🇷🇺RU
  • 🇨🇳ZH

Getting Started

  • Can’t see the Master Addon Element inside Elementor Page editor?
  • How To Apply For an Affiliate Account?
  • Active Pro version
  • Installing Plugin

Addons

  • Popup Trigger
  • Off-Canvas Content
  • Logo Slider
  • Progress Bars
  • Image Carousel
  • Featured Product
  • Comparison Table
  • Source Code
  • Advanced Image
  • Gradient Headline
  • Gallery Slider
  • Toggle Content
  • Infobox
  • Timeline
  • Dynamic Table
  • Mailchimp
  • Blockquote
  • Changelogs
  • Countdown Timer
  • Current Time
  • Search
  • Filterable Image Gallery
  • Team Slider
  • Counter Up
  • Restrict Content
  • Table of Contents
  • Image Hotspot
  • Image Comparison
  • News Ticker
  • Image Hover Effects
  • Tabs
  • Pricing Table
  • Navigation Menu
  • Domain Search
  • Flipbox
  • Tooltip
  • Creative Links
  • Business Hours
  • Contact Form 7
  • Creative Button
  • Animated Headlines
  • Advanced Accordion
  • Call to Action
  • Progress Bar
  • Blog
  • Team Member
  • Dual Heading

Extensions

  • Mega Menu
  • Which Element
  • Post Duplicator
  • Grid Line
  • Glassmorphism
  • Tooltip
  • Wrapper Link
  • Floating Effects
  • Dynamic Tags
  • Display Conditions
  • Entrance Animation
  • Custom Breakpoints
  • Animated Gradient Background
  • Reveal
  • Particles
  • Background Slider
  • Transforms
  • Rellax
  • Positioning
  • Custom CSS

Widget Builder

  • Conditions
  • Twig Syntax
  • Settings Panel Introduction
  • Divider
  • Text Shadow
  • Select2
  • Border
  • Heading
  • Tabs
  • Repeater
  • Visual Choice
  • Background
  • Dimensions
  • Box Shadow
  • Slider
  • Icons
  • Gallery
  • Media
  • Popover Toggle
  • URL Field
  • Date Time
  • Typography
  • Font
  • Color Field
  • Choose
  • Select
  • Switcher
  • Hidden
  • Code
  • WYSIWYG
  • Textarea Field
  • Number
  • Text Field

Theme Builder

  • Comment Form
  • 404
  • Search
  • Archive
  • Single
  • Footer
  • Header

Popup Builder

  • How to Open a Popup After Inactivity in Elementor
  • How to Show an Exit Intent Popup in Elementor
  • How to Open a Popup on Scroll to a Specific Element in Elementor
  • How to Open a Popup on Scroll in Elementor
  • How to Open a Popup on Click in Elementor
  • How to open a popup on page load?
  • Popup Settings & Options

Template Kit

  • How to Import Template Kits in Master Addons
  • How to Disable Elementor Default Fonts and Colors
  • Import Elementor Template Kits
View Categories
  • Home
  • Docs
  • Widget Builder
  • Code

Code

Roy Jemee
Updated on August 6, 2026

7 min read

The Code field puts a real code editor into a custom widget’s panel. Syntax highlighting, monospaced text, line numbers, all courtesy of the Ace editor. It exists for the cases where an editor needs to paste markup rather than write prose: embed snippets, schema blocks, badge HTML from a third party. Inside the Master Addons Widget Builder, you choose the highlighting language and how tall the editor sits in the panel.

Like every Widget Builder field, the Code field supports Conditions for panel visibility, and its token prints through the Twig-syntax template engine with safe HTML allowed through automatically. See both guides for setup and limitations.

Output goes through WordPress sanitization. The value prints with a normal token, and the runtime passes it through wp_kses_post, the same filter WordPress applies to post content. Safe HTML tags survive; <script> tags are stripped. That default protects the site from whatever gets pasted into the field.

What the Code field does #

  • Renders an Ace code editor in the widget’s Elementor panel, with syntax highlighting for the language you pick.
  • Stores the pasted code as a string.
  • Prints that string through {{ your_field_name }}, sanitized with wp_kses_post so allowed HTML renders and scripts are removed.
  • Offers a |raw filter escape hatch that bypasses sanitization for trusted-admin scenarios.
  • Sets its visible height through a rows option, so long snippets get room in the panel.

If you have never built a widget with the builder, read the Widget Builder overview first; the field pages assume that groundwork.

Before you start #

  • WordPress with Elementor installed and active.
  • Master Addons for Elementor installed and active. New to the plugin? See the installation guide.
  • A custom widget open in the Widget Builder editor. Our example is a trust badge widget where a Code field named badge_markup accepts the badge HTML that payment and review providers hand out.

How to add a Code field #

Drag the Code field from the fields panel into a section under the Content tab. The field’s options open on the left the moment it lands.

Code field options explained #

  • Label: the text shown above the editor in Elementor, for example “Badge Markup”.
  • Name: the unique identifier your templates refer to. Letters, numbers, and underscores only, for example badge_markup.
  • Default: starting code the widget ships with, useful as a filled-in example of what the field expects.
  • Language: the syntax highlighting mode, HTML, CSS, JavaScript, and other common modes. This affects highlighting only, not what can be typed.
  • Rows: the visible height of the editor in the panel.

Connect the Code field with its token #

The Code field is a token field. Print it where the pasted markup should land in the HTML panel:

<div class="tb-badges">
  {{ badge_markup }}
</div>

On output, the value runs through wp_kses_post. In practice that means the tags WordPress allows in post content, <div>, <a>, <img>, <span>, and the rest, render as pasted, while <script> tags and event-handler attributes are stripped. For a badge or schema snippet built from plain markup, the default behavior is exactly what you want.

Bear in mind that kses strips tags silently. If a pasted snippet renders half-empty on the page, nothing errored; the filter removed a disallowed tag and kept the rest. Test provider snippets on a staging page once before handing the widget to a client, so you know which parts survive.

When a snippet genuinely needs to survive untouched, the |raw filter bypasses sanitization:

{{ badge_markup|raw }}

Watch out: |raw outputs whatever was pasted, scripts included. Only reach for it when everyone who can edit the widget is already trusted with unfiltered HTML, effectively admin-level users, and never on widgets that lower-privilege editors or clients can touch. The default sanitized token is the right choice for almost every widget you ship.

Guard against an empty field like you would any optional value, so an unused Code field leaves no stray wrapper behind:

{% if badge_markup %}
<div class="tb-badges">{{ badge_markup }}</div>
{% endif %}

Use the Code control in Elementor #

Add your custom widget to a page in Elementor, or reload the editor if the page was already open. The Code field appears as a dark editor block under your label, sized to the rows you set.

Paste or type the snippet. Highlighting follows the language you chose in the builder, which makes malformed markup easier to spot before it hits the page, and the preview updates as the field changes.

Common use cases #

  • Badge and certification markup from payment, security, and review providers.
  • Schema and structured-data snippets an SEO plugin does not cover.
  • Embed codes for players and forms, where the sanitized subset is enough.
  • Custom table or list markup that would be painful to rebuild with individual fields.
  • Ad or promo blocks whose HTML changes per campaign without republishing the widget.

Tips for working with the Code field #

  • Trust the default sanitization. wp_kses_post keeps normal markup intact and quietly removes the dangerous parts. Most “my snippet is broken” reports are a stripped <script> tag doing its job.
  • Reserve |raw for admin-only widgets. It disables the safety net for that token entirely.
  • Set the Language to match the content. Highlighting is a proofreading aid; HTML mode makes a missing closing tag visible at a glance.
  • Ship a Default snippet. A commented example shows editors exactly what shape of code belongs in the field.
  • Wrap the token in {% if %} when the snippet is optional, so an empty field renders no empty container.
  • Use WYSIWYG for prose. If editors will write text rather than paste markup, the WYSIWYG field is the friendlier control.

Frequently Asked Questions #

What is the Code field in the Master Addons Widget Builder?

The Code field adds a syntax-highlighted Ace editor to a custom Elementor widget’s panel. Editors paste markup or snippets into it, and the template prints the value with {{ field_name }}, sanitized through wp_kses_post so allowed HTML renders and script tags are stripped.

Why is my pasted <script> tag not running?

Sanitization removed it. Output passes through wp_kses_post, which does not allow script tags. If the widget is only ever edited by trusted admins, {{ field_name|raw }} bypasses the filter, at the cost of outputting the paste unfiltered.

What is the difference between the Code field and the WYSIWYG field?

The Code field shows raw source with syntax highlighting and is meant for markup and snippets. The WYSIWYG field shows a TinyMCE rich-text editor meant for writing formatted prose. Both sanitize output with wp_kses_post.

Does the Language option restrict what can be entered?

No. It only selects the syntax highlighting mode, HTML, CSS, JavaScript, and so on. Any text can be pasted regardless of the mode.

Can I print the code somewhere other than the HTML panel?

The token works in all three panels, but the HTML panel is where snippets belong in practice. Sanitized markup has little meaning inside a stylesheet or script block.

Is it safe to give clients a widget with a Code field?

With the default token, yes within reason: wp_kses_post enforces the same HTML subset WordPress allows in post content. Avoid |raw on client-editable widgets, since it removes that enforcement.

Wrapping up #

The Widget Builder Code field turns “paste your snippet here” into a proper workflow: a highlighted editor in the panel, one token in the template, and WordPress-grade sanitization between the paste and the page. Use it for markup, keep |raw for the rare trusted case, and reach for the WYSIWYG field when the content is prose instead of code. Explore the rest of the Master Addons widgets and extensions, and see the pricing page for what each plan includes.

What are your Feelings

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on August 6, 2026
HiddenWYSIWYG
Table of Contents
  • What the Code field does
  • Before you start
  • How to add a Code field
  • Code field options explained
  • Connect the Code field with its token
  • Use the Code control in Elementor
  • Common use cases
  • Tips for working with the Code field
  • Frequently Asked Questions
    • What is the Code field in the Master Addons Widget Builder?
    • Why is my pasted tag not running?
    • What is the difference between the Code field and the WYSIWYG field?
    • Does the Language option restrict what can be entered?
    • Can I print the code somewhere other than the HTML panel?
    • Is it safe to give clients a widget with a Code field?
  • Wrapping up

Join 30,000+ Web Creators Who Trust Master Addons

Get all the premium widgets and templates you desire, built with clean code that keeps your site fast. Ditch the bloat, not the features.

Try Live Demo
Join The Community
Master Addons for Elementor

80+ Premium Widgets & Lifetime Updates – Build Beyond Limits. An Exclusive Creation by Pixar Labs

Facebook-f Twitter Youtube Wordpress
Features
  • Template kits
  • Template Library
  • Widget Builder
  • Theme Builder
  • Mega Menu Builder
Support
  • Support Forum
  • Contact US
  • Join Community
  • Blog
  • Video Reviews
Resources
  • My Account
  • Changlogs
  • Documentation
  • Video Tutorials
  • Toolz.dev
Navigate
  • Apply for Affiliate
  • Terms of Use
  • Refund Policy
  • Privacy Policy
  • About Us