Magento 2: Layout Update XML (Admin) Remove & Add Blocks

Magento 2: Layout Update XML (Admin) Remove & Add Blocks

July 18, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 2: Layout Update XML (Admin) Remove & Add Blocks

Magento 2: Layout Update XML (Admin) - Remove & Add Blocks

Hello developers! Today we’re going to tackle a common challenge faced by many Magento administrators - updating layout XML files to remove existing blocks and add new ones, specifically for the “2 columns with left bar” CMS pages.

The Scenario

You have full admin access to your Magento EE 2.1.4 instance but no server access. You’re working with pre-existing CMS pages that use the “2 columns with left bar” layout. Your goal is to replace the existing sidebar menu with a static block at the page level.

The problem? You don’t know the container or block names required for the XML update, and you can’t access the relevant PHTML files through your agency’s 3rd party dev setup.

The Challenge

In the admin section, the block containing the menu you want to remove has an identifier called “advice_leftmenu”. However, when you try to remove it using:

<referenceBlock name="advice_leftmenu" remove="true"/>

Nothing happens. You’ve also tried various combinations like sidebar.sidebar-main and sidebar-main, but with no success.

The HTML surrounding the sidebar provides some clues, but it’s not clear where to look for definitive container/block names:

<div class="columns">
    <div class="sidebar sidebar-main">
        <div class="widget block block-static-block">
            <div class="left-cms-content">
                ...
            </div>
        </div>
    </div>
</div>

The Solution

Thanks to a suggestion from @Nolwennig, enabling theme hints can be a game-changer. This feature allows you to see container and block names right in your admin interface.

To add a new block using the updated information:

<referenceContainer name="sidebar.main">
   <block class="Magento\Cms\Block\Block" name="buyers-menu">
       <arguments>
            <argument name="block_id" xsi:type="string">buyers-menu</argument>
       </arguments>
   </block>
</referenceContainer>

Remember to replace buyers-menu with the actual ID of your static block.

The Sticking Point

While adding new blocks works, removing existing ones is still a challenge. You’ve identified that the block you want to remove has an ID called left_cms_content, but:

<referenceBlock name="left_cms_content" remove="true"/>

Still doesn’t work.

Conclusion and Next Steps

So here’s where we stand: adding new blocks is possible with the right container/block names, which theme hints can help uncover. Removing existing blocks remains a mystery that requires further investigation.

My recommendation? If possible, try to engage your agency for assistance in identifying these specific block and container names. They have access to the underlying codebase and may be able to provide the exact identifiers needed for this layout update.

For a more comprehensive guide on Magento 2 layout updates, I recommend checking out this excellent resource: LaravelCompany’s Guide to Magento 2 Layout XML Updates.

Remember, understanding the Magento layout structure is key to making efficient changes. Happy coding!

Magento 2 Themes Admin Errors

Our network