0

Unable to Get meta title on category page.

$this->getLayout()->getBlock('head')->getTitle();

Error:

Fatal error: Uncaught Error: Call to a member function getTitle() on boolean

Magento 2.3.0

3
  • in which file are you doing it ? Commented Jan 3, 2019 at 13:31
  • Where do i have to add this? i am having the same problem on my magento 2 installation! Commented Jan 16, 2019 at 21:21
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review Commented Jan 16, 2019 at 21:50

1 Answer 1

0

Try using these codes:

if(Mage::registry('current_category'))
{
   echo  Mage::registry('current_category')->getMetaTitle();
}else {

 echo $this->getTitle()
 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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