I know that you can turn template path hints on in Magento2 through the Admin Panel at Stores > Configuration > ADVANCED > Developer.

Although in Magento 1 I find it much quicker to temporarily edit a single line of code in app/code/core/Mage/Core/Block/Template.php. At line 200 I simply change:

return self::$_showTemplateHints;


return true;

It saves a lot of time than going through the admin panel. Is there somewhere in Magento 2 where I can similarly turn on Template Path hints by editing a line of code this way?


I like ho-nl/magento2-Ho_Templatehints, you can get the required info without breaking the layout



I strongly discourage this. Use at your own risk. Only to be used on local system.

Open vendor/magento/module-developer/Model/TemplateEngine/Plugin/DebugHints.php (tested in 2.3.2)

write this code inside afterCreate function : (at the start, above the storecode line)

if(isset($_GET['shreyasPathHints']) && $_GET['shreyasPathHints'] == 'on'){
    return $this->debugHintsFactory->create([
        'subject' => $invocationResult,
        'showBlockHints' => 1,

Now, you can open any magento page and append ?shreyasPathHints=on to the url. No need to run any commands.


My suggestion: use MageRun 2: https://github.com/netz98/n98-magerun2

Then you can just do:

n98-magerun2.phar dev:template-hints enable

And to disable:

n98-magerun2.phar dev:template-hints disable

But to answer your question, even if I strongly discourage that, just edit app/code/Magento/Developer/Model/TemplateEngine/Plugin/DebugHints.php and replace in the constructor:

$this->debugHintsPath = $debugHintsPath;


$this->debugHintsPath = true;
  • thanks but editing vendor/magento/module-developer/Model/TemplateEngine/Plugin/DebugHints.php did not work for me.
    – Holly
    Mar 17 '17 at 12:23

It's saved in DB.

In table core_config_data, there are those 3 lines:

ID | default | 0 | dev/debug/template_hints_storefront | 1/0
ID | default | 0 | dev/debug/template_hints_admin      | 1/0
ID | default | 0 | dev/debug/template_hints_blocks     | 1/0

In value column it's bool 1 or 0. You can write quick and dirty script to change that. Also there is plenty of tools that can help you with that.

If you use PhpStorm I would recomend http://www.magicento.com/ plugin.


I would like to recommend Easy Template Path Hints. It enables template path hints in magento 2 by just appending ?tp=1 in url and you can also add access code from admin configuration if you are thinking someone else would enable it.

It is very handy for frontend development.


You shouldn't edit code because at the end you will forget to remove it. Although I don't find template-hints useful anyway. It's strange such things don't exist in the command-line already but well.. You should add a new cli command to turn template-path hints on and off.

See: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/cli-cmds/cli-howto.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.