🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Get WYSIWYG Editor’s data in Magento 2 Frontend

By Sanjay JethvaUpdated on May 22, 2025 1 min read

The technique to add WYSIWYG editor in Magento 2 store configuration makes the admin’s task much easier to work with content editing.  Have you checked the frontend after implementing WYSIWYG editor in the admin configuration?

Strange output, isn’t it? 

You can see the inability of the WYSIWYG editor to convert the HTML content.

Magento 2 fails to convert WYSIWYG content into the readable format in the condition when the content has been added from the WYSIWYG editor from the configuration section. To resolve the issue and get WYSIWYG editor’s data in Magento 2 frontend, follow the below method:

Method to Get WYSIWYG Editor’s data in Magento 2 Frontend:

1. Create registration.php file in app\code\[Vendor]\[Namespace]\

<?php
        \Magento\Framework\Component\ComponentRegistrar::register(
            \Magento\Framework\Component\ComponentRegistrar::MODULE,
            '[Vendor]_[Namespace]',
            __DIR__
        );

2. Create module.xml file in app\code\[Vendor]\[Namespace]\etc

<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
        <module name="[Vendor]_[Namespace]" setup_version="1.0.0"/>
    </config>

3. Create ConfigBlock.php file in app\code\[Vendor]\[Namespace]\Helper

<?php
    namespace [Vendor]\[Namespace]\Helper;

    use Magento\Framework\App\Helper\AbstractHelper;
    
    class ConfigBlock extends AbstractHelper
    {
        protected $templateProcessor;
        public function __construct(
            Context $context,
            \Zend_Filter_Interface $templateProcessor
        )
        {
            $this->templateProcessor = $templateProcessor;
            parent::__construct($context);
        }
        public function getConfigContent($content) // $content you need to pass config value
        {
            try{
                return $this->templateProcessor($content);
            }catch (\Exception $e){
                return false;
            }
        }

    }

That’s it.

Now you can use the WYSIWYG editor in the system configuration, and at the same get proper output in the frontend!

Thanks!

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.