{"id":423,"date":"2019-05-17T10:47:17","date_gmt":"2019-05-17T10:47:17","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/05\/17\/add-wysiwyg-editor-in-magento-2-system-configuration\/"},"modified":"2025-05-22T16:51:35","modified_gmt":"2025-05-22T11:21:35","slug":"add-wysiwyg-editor-in-magento-2-system-configuration","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/add-wysiwyg-editor-in-magento-2-system-configuration\/","title":{"rendered":"How to add WYSIWYG Editor in Magento 2 System Configuration"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">WYSIWYG is an HTML editor for easy content editing. WYSIWYG enables adding and formatting the content providing \u201c<i>What You See Is What You Get<\/i>&nbsp;\u201d view. Preview the end result in the editing phase itself and thus avoid handling HTML tags! Interesting, isn&#8217;t it?&nbsp; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, the default Magento 2 does not offer WYSIWYG editor in the system configuration. Admin may want to display messages in a certain manner in frontend. The WYSIWYG editor makes the task simpler.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To overcome the default Magento 2 limitation, implement the below method to <strong>add WYSIWYG editor in Magento 2 system configuration<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Add WYSIWYG Editor in Magento 2 System Configuration:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add below code in the <strong>system.xm<\/strong>l file<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;field id=\"description\" translate=\"label comment\" type=\"editor\" sortOrder=\"20\" showInDefault=\"1\"\n                       showInWebsite=\"1\" showInStore=\"1\">\n    &lt;label>Description &lt;\/label>\n    &lt;frontend_model>Vendor\\Extension\\Block\\Adminhtml\\Editor&lt;\/frontend_model>\n&lt;\/field><\/pre>\n\n\n\n<ul start=\"2\" class=\"wp-block-list\">\n<li>Create new file&nbsp;<strong>Editor.php<\/strong>&nbsp;at&nbsp;<strong><strong>Vendor\\Extension\\Block\\Adminhtml folder<\/strong><\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\nnamespace Vendor\\Extension\\Block\\Adminhtml;\n\nuse Magento\\Backend\\Block\\Template\\Context;\nuse Magento\\Cms\\Model\\Wysiwyg\\Config as WysiwygConfig;\n\nclass Editor extends \\Magento\\Config\\Block\\System\\Config\\Form\\Field\n{\n    public function __construct(\n        Context $context,\n        WysiwygConfig $wysiwygConfig,\n        array $data = []\n    )\n    {\n        $this->_wysiwygConfig = $wysiwygConfig;\n        parent::__construct($context, $data);\n    }\n\n    protected function _getElementHtml(\\Magento\\Framework\\Data\\Form\\Element\\AbstractElement $element)\n    {\n        $element->setWysiwyg(true);\n        $element->setConfig($this->_wysiwygConfig->getConfig($element));\n        return parent::_getElementHtml($element);\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s all about WYSIWYG editor in system configuration for Magento 2!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you implement this solution, please refer our blog <a href=\"https:\/\/meetanshi.com\/blog\/get-wysiwyg-editors-data-in-magento-2-frontend\/\" target=\"_blank\" rel=\"noreferrer noopener\">Add WYSIWYG Editor in Magento 2 System Configuration<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WYSIWYG is an HTML editor for easy content editing. WYSIWYG enables adding and formatting the content providing \u201cWhat You See Is What You Get&nbsp;\u201d view&#8230;.<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-423","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=423"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/423\/revisions"}],"predecessor-version":[{"id":15424,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/423\/revisions\/15424"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}