PHP Joomla! 6 Joomla! 5 Joomla! 3 (Legacy) Plugin Basic

Check if a Content Plugin Is Enabled and Read Its Options

Checks whether a specific content plugin is published before safely reading its Registry parameters.

Updated on 24 November 2026 20 copies 97 views
templates/seu_template/html/com_content/article/default.php
<?php

declare(strict_types=1);

use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Registry\Registry;

if (PluginHelper::isEnabled('content', 'relatedarticles')) {
    $plugin       = PluginHelper::getPlugin('content', 'relatedarticles');
    $pluginParams = new Registry($plugin->params);
    $catids       = (array) $pluginParams->get('catids', []);
}
Uses PluginHelper::isEnabled() and namespaced Registry in Joomla 5 and 6.
templates/seu_template/html/com_content/article/default.php
<?php
$plugin = JPluginHelper::getPlugin('content', 'relatedarticles');

// Verifica se o plugin está habilitado
if ($plugin) {
    $pluginParams = new JRegistry($plugin->params);
    $catids       = $pluginParams->get('catids');
}
Classic Joomla 3 check using JPluginHelper::getPlugin().

Technical explanation and best practices

Prevents runtime errors whenever a template or module reads configuration from an optional content plugin such as related articles.

Checking PluginHelper::isEnabled() before parsing $plugin->params keeps overrides resilient.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.