In magento you can create and CMS pages in admin->CMS->Page. Additionally, you can also create it by setup or upgrade module. In this topic, you can know how to insert CMS page into Magento 2 by setup script through specific steps:

  • Step 1: Create UpgradeData.php File
  • Step 2: Setup the module version
  • Step 3: Run setup script through command line

Step 1: Create UpgradeData.php File

File directory: app/code/Magestore/Example/Setup/UpgradeData.php

Step 2: Setup the module version

Open etc/module.xml file, you need to set your module version in setup_version attribute that should be 1.1

Step 3: Run setup script through command line

Finally, Open terminal and run command line

bin/magento setup:upgrade

Check the result on admin->CMS->pages

Good luck!

We also contribute great content of Magento Download for FREE (all versions)

DON'T MISS THE CHANCE!

magento download

How to Add Custom Attribute to Customer Programmatically?
How to Update a Column in a Table from Another Table's Column

Leave a Reply

Your email address will not be published. Required fields are marked *