How can I add custom fields in cms edit page (Admin Panel)?

How can I add custom fields in cms edit page (Admin Panel)?

August 18, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How can I add custom fields in cms edit page (Admin Panel)?

Solving Custom CMS Field Issues in Magento

Adding custom fields to your Magento admin panel for the CMS page can be a powerful way to extend functionality without modifying core files. However, it seems you’re facing some challenges with the implementation process.

Understanding the Current Approach

Your current approach uses a guide from Flexishore that outlines adding a custom field to the CMS page in Magento 1.7. While this method was valid for its time, many of these techniques are no longer supported or recommended in modern versions of Magento like 2.x and 3.x.

The main issue lies in using getLoad() function which has been deprecated since version 1.6. When you attempt to use it, the error “Call to undefined function getLoad()” is thrown because the function does not exist anymore.

The Modern Approach: Using Layout XML

In the newer versions of Magento (2.x and later), we have moved away from such direct manipulation techniques towards using layout XML and plugin architecture. This approach provides a more stable and secure way of extending functionality without risking conflicts with core files or updates.

Here’s an updated guide on how to add a custom field to your CMS page in the admin panel:

  1. Create a new module: Use Magento’s module creator tool or manually create a new module directory structure at app/code/Vendor/Magento-CmsField. Make sure to replace ‘Vendor’ with your actual vendor name.

  2. Define dependencies: In app/code/Vendor/Magento-CmsField/composer.json, add:

"require": {
    "magento/framework": "~100.0"
},

This ensures that the module depends on the Magento framework.

  1. Create layout XML: Add a new file at app/code/Vendor/Magento-CmsField/view/adminhtml/layout/cms_page_index.xml with content similar to:
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout.xsd">
    <update handle="cms_page_index"/>
    <referenceContainer name="content">
        <block class="Magento\Backend\Block\Widget\Form\Container" as="cms_page_form_container">
            <block class="Vendor\MagentoCmsField\Block\Adminhtml\CmsPage\Edit\Tab\CustomFields"
                   template="Vendor_MagentoCmsField::customfields.phtml"/>
        </block>
    </referenceContainer>
</layout>

This layout instruction tells Magento to include your custom tab (defined below) into the CMS page edit form.

  1. Create the custom fields block: At app/code/Vendor/Magento-CmsField/Block/Adminhtml/CmsPage/Edit/Tab/CustomFields.php, create a simple block extension:
namespace Vendor\MagentoCmsField\Block\Adminhtml\CmsPage\Edit\Tab;

class CustomFields extends \Magento\Framework\View\Element\Template implements \Magento\Framework\DataObject\IdentityInterface
{
    const CACHE_TAG = 'cms_page';

    protected $_template = 'Vendor_MagentoCmsField::customfields.phtml';

    public function getIdentities()
    {
        return [self::CACHE_TAG . '_' . $this->getPageId()];
    }

    public function getPageId()
    {
        return $this->getRequest()->getParam('id');
    }
}
  1. Create the custom fields template: At app/code/Vendor/Magento-CmsField/view/adminhtml/templates/customfields.phtml, add your HTML for the custom fields.

  2. Save and activate the module: In your Magento admin panel, navigate to System > Configuration > Advanced > Developer Mode, set it to ‘Yes’. Then, go to System > Tools > Compilation Status and run the compilation process. Reflush cache using System > Cache Management.

Conclusion

Adding custom fields to the CMS page in modern versions of Magento requires a more modular approach than direct manipulation. By following this guide, you can easily add new fields without touching core files or risking conflicts during updates.

Remember, always backup your files before making changes and test thoroughly on a staging environment before deploying to production. If you need further assistance with custom development for your Magento store, feel free to contact our experts at Laravel Company.

By implementing these best practices, you can extend the functionality of your admin panel while maintaining the stability and security of your Magento installation.

Magento 1 Database Extensions Themes

Our network