I tried everything I could (yes, searching with google for a long time too) but I can't find what I am doing wrong here. I am trying to write Joomla plugin to change shortcode into list od adverts on OtoMoto.pl. But I am stuck on changing shortcode to any text. For some reason joomla don't even trigger my code in function. Could anyone help me with that? I am using Joomla 3.9.23 Stable, PHP 7.4.10 and below is my code:

defined( '_JEXEC' ) or die( 'Restricted access' );
class plgContentOtoMotoShortcode extends JPlugin
    protected $autoloadLanguage = true;

    function onContentPrepare($context, &$article, &$params, $limitstart = 0)
        $list_of_adverts = "Temporary";
        $text = str_replace('[otomoto]', $list_of_adverts, $article->text);
        $article->text = $text;
        return true;


<?xml version="1.0" encoding="utf-8" ?>
<extension version="3.2" type="plugin" group="content" method="upgrade">
    <author>Futuristic Tomasz Burzyński</author>
    <creationDate>November 2020</creationDate>
    <copyright>Copyright (C) 2020</copyright>
    <license>Private, if you get this code for free you probably have it illegaly</license>
    <authorEmail>[email protected]</authorEmail>
    <description>Shortcode for OtoMoto adverts list</description>
        <filename plugin="otomoto">otomoto.php</filename>

Instalation of plugin went without problems so I really have no idea what is going wrong. I will add one more thing: I checked, plugin code is loaded on site, but its event just doesn`t work. I will be gratefull for any tip what's wrong with that code.


1 Answer 1


It's not triggering because the class is incorrect.

The class of the plugin must correspond to the plugin="" attribute value on the <filename> element in your XML file. It's also case sensitive.

Seeing as you have used:

<filename plugin="otomoto">

you should replace:

class plgContentOtoMotoShortcode 


class plgContentOtomoto

Your Answer

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

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