Add category attribute with WYSIWYG enabled

Add category attribute with WYSIWYG enabled

July 7, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Add category attribute with WYSIWYG enabled

Enabling WYSIWYG for Category Attributes in Magento

You’re on the right track with adding an attribute via code setup. However, enabling WYSIWYG for your custom category attributes requires a few extra steps that aren’t covered in the tutorial you’ve been following.

The issue lies in how the WYSIWYG editor is configured and applied to specific fields. Your current setup correctly defines the ‘wysiwyg_enabled’ flag as true, but Magento doesn’t automatically apply it during the attribute installation process.

To resolve this issue, we need to manually create a new WYSIWYG configuration for your custom attribute. Let’s go through the necessary steps:

Step 1: Define the WYSIWYG configuration

First, you’ll need to define a new WYSIWYG configuration in your Magento setup. This can be done by adding the following code inside your module’s config.xml file:

<global>
    <editorConfig>
        <editor>
            <area>adminhtml</area>
            <files>
                <file type="txt">MyCustomWYSIWYG</file>
            </files>
        </editor>
    </editorConfig>
</global>

In this example, MyCustomWYSIWYG is the name of your new configuration. You can replace it with any unique identifier you prefer.

Step 2: Configure WYSIWYG for the custom attribute

Next, update your attribute setup code to include a reference to the newly created WYSIWYG configuration:

$this->startSetup();
$this->addAttribute('catalog_category', 'custom_att', array(
    ...
    'wysiwyg_config' => 'MyCustomWYSIWYG',
    ...
));
$this->endSetup();

The wysiwyg_config parameter should match the name you gave to your configuration in step 1.

Step 3: Reinstall the custom attribute

After updating your code, clear all Magento cache and reinstall the custom attribute. You can do this using the following commands:

php bin/magento cache:clean
php bin/magento setup:upgrade

This will update your database with the new WYSIWYG configuration for the ‘custom_att’ attribute.

Conclusion

Enabling a WYSIWYG editor for custom category attributes in Magento requires careful configuration of both the attribute setup and the WYSIWYG settings. By defining a new WYSIWYG configuration and referencing it correctly during attribute installation, you can ensure that your custom fields support rich text editing.

Remember to always test these changes thoroughly before deploying them to your live production environment. If you’re looking for more advanced Magento development guidance, check out the comprehensive resources available at Laravel Company.

The key takeaway is to understand how to configure WYSIWYG settings properly and apply them to custom attributes during installation. This approach ensures that your attributes have the desired rich text editing functionality without requiring manual configuration after attribute creation.

Happy coding!

Catalog Extensions Admin Configuration

Our network