Where are Magento static CMS blocks stored?

Where are Magento static CMS blocks stored?

September 6, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Where are Magento static CMS blocks stored?

Understanding Magento Static CMS Blocks

Static CMS blocks are one of the most powerful features in Magento that allow you to create reusable chunks of HTML content. They can be placed anywhere on your website using a simple call to the getLayout()->createBlock('cms/block') function.

If you’re struggling to locate these static blocks within your database or file system, don’t worry - we’ll guide you through it in this post.

Where Are Static CMS Blocks Stored?

Magento stores static block data primarily in two places: the database and the filesystem. Let’s look at each one:

Database Storage

The main database table where Magento stores its static blocks is cms_block. This table contains information about all your static blocks, including their title, content, identifier (unique key), and other metadata.

Here’s a quick schema of the cms_block table for reference:

CREATE TABLE `cms_block` (
  `block_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL default '',
  `identifier` varchar(36) NOT NULL default '',
  `content` text,
  `created_in` datetime DEFAULT NULL,
  `updated_in` datetime DEFAULT NULL,
  PRIMARY KEY (`block_id`)
);

Filesystem Storage

When you create a static block, Magento does not directly store the HTML content in your theme files. Instead, it stores the block’s identifier and position in the layout XML files.

For example, if you add a static block with an identifier of “my-block” to the homepage, Magento will update your catalog.xml file (found typically under app/design/frontend/[package]/[theme]/layout) to include something like:

<block type="cms/block" name="my-block">
  <action method="setBlockId"><identifier>my-block</identifier></action>
</block>

Creating Static Blocks Programmatically

If you want to create static blocks programmatically, Magento provides a simple API in the Mage_Cms_Block model. Here’s an example:

$block = Mage::getModel('cms/block');
$block->setTitle('My Block Title')
      ->setIdentifier('my-block')
      ->setContent('<h1>Hello, World!</h1>');

try {
    $block->save();
} catch (Exception $e) {
    // Handle error
}

// Display the block
echo $block->toHtml();

Remember to include this code in a controller or observer that’s within your theme or module.

Conclusion

Magento’s static blocks are a powerful tool for reusing content across your site. They’re stored primarily in the cms_block database table and referenced via layout XML files.

When moving your Magento installation, ensure you migrate both your cms_block data and any relevant layout XML changes.

For more advanced customizations with static blocks, check out our guide on Extending Magento’s CMS functionality at LaravelCompany.

Database Themes SEO

Our network