I need to add meta description inside a component page. That's what I tried:

$menu      = $app->getMenu(); // Load the JMenuSite Object
$active    = $menu->getActive(); // Load the Active Menu Item as an stdClass Object
$meta_description = $active->params->menu-meta_description;
$document->addCustomTag('<meta name="description" content="' . $meta_description . '">');

The result is not what I would expect:

<meta name="description" content="0">

Obviously, my content is different from "0". So, what's wrong in my code?


1 Answer 1


I solved it myself with:

$meta_description = $active->params->get('menu-meta_description');

Here are some relevant/supporting references:

  • Your answer was flagged by the system for being low quality due to its length. I have edited your answer to include some useful references. It is great that you were able to self-solve and that you shared your solution with the Joomla community. In the future, please offer a bit more insight in your answers if possible. Providing an explanation of how/why your solution works and/or supporting resources will make your contributions much more valuable to future researchers. Thanks for sharing. Please take the tour.
    – mickmackusa
    Dec 23, 2019 at 20:45

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.