Magewallet

Magento 2 Extensions, Themes & Services

How to get current CMS page id in Magento2

To get the id of current CMS page in Magento 2, use the following code snippet.

There are so many other methods to get CMS page details like title, identifier, content, and content heading. Lets check one by one.

To get the identifier of the current CMS page you can use

To get the Page Title :

To get the Page Content :

To get the Page Content Heading:

Thats it. Enjoy Magento 2!! Enjoy Magewallet!!!

Mahendra Paladiya
Mahendra is a Web Developer whose passions includes web development, technical blog writing, and database management. His passion for web development pushed him into learning how to handle different platforms like Core PHP, Magento, Prestashop, WordPress, CodeIgniter, CakePHP and Oracle.

2 Comments

  1. Where do I write this piece code? Thanks

    • Hi Paul,

      You can use this code snippet with any helper or block file. Let us know if you need more details for the same.

      Thanks

Leave a Reply

Your email address will not be published.

*

 

© 2017 Magewallet

Theme by Anders NorenUp ↑