How to access Joomla plugin parameters anywhere inside Joomla code?

When developing a new Joomla extension or making changes to existing extension, you might need to access plugin parameters of a Joomla plugin outside the plugin code. There can be cases where you want to access plugin parameters in some Joomla module or component. Now the question is - How to get plugin parameters outside the plugin code?


Here is a snippet of a Joomla code in PHP that lets you access plugin parameters anywhere inside Joomla.

// Get plugin 'my_plugin' of plugin type 'my_plugin_type'
$plugin = JPluginHelper::getPlugin('my_plugin_type', 'my_plugin');

// Check if plugin is enabled
if ($plugin)
	// Get plugin params
	$pluginParams = new JRegistry($plugin->params);

	$param1 = $pluginParams->get('param1');
	$param2 = $pluginParams->get('param2');
	$param3 = $pluginParams->get('param3');


Wasn’t that easy?
I hope this helps! Thanks for reading!
Feel free to add your comments.