<p>You could get around this by creating your own renamed copies of those functions. </p>

<ol>
<li>Create a module.</li>
<li>Copy the content of each affected plugin's twigextensions folder to your module's twigextensions folder.</li>
<li>Adjust the namespaces in these files to match your module</li>
<li>Rename the functions / filters in these files to something unique.</li>
<li>Load these twigextensions in your module's main file (<code>use</code> statement plus <code>Craft::$app-&gt;view-&gt;registerTwigExtension</code>).</li>
<li>You can now use the filters in twig by referencing the unique name you gave them.</li>
</ol>

<p>If you haven't worked with modules before, you can use pluginfactory.io to scaffold a module that includes lots of example code, including all the required code to set up a twig extension.</p>

<p>To improve on this further, instead of a straight up copying of the twig extensions, refactor them to call the public functions in the original plugin files. This will ensure it's much less likely to break things when the plugin gets updated later.</p>

CC BY-SA 4.0
2019-10-23T09:11:39.080Z
2019-10-23T09:11:39.080Z
Udo
<p>If two plugins have a Twig filter/function that has an identical name, then whichever one "wins" will be the plugin that is loaded first (alphabetically, I believe).</p>

<p>No real way I can think of to get around it other than to contact the plugin developers and have one of them change the name.</p>

CC BY-SA 4.0
2019-10-22T21:04:04.430Z
2019-10-22T21:04:04.430Z
Brad Bell
<p>I'm trying to use a filter function from a plugin, but it turns out two plugins that I have installed have the same function name and the wrong one is getting called. For now I edited the vendor files to rename the function, but I don't want that to be my final solution in case I want to upgrade the plugin later. </p>

<p>What is the best way to go about circumventing this type of conflict between two plugins?</p>

CC BY-SA 4.0
2019-10-21T19:14:34.043Z
"same function name" - they have the same Twig filter function name?
Brad Bell
CC BY-SA 4.0
2019-10-22T06:38:49.370Z
@BradBell Yes they have the same Twig filter function name
Brimby
<craft3><plugins>
Two plugins contain the same function name so they're conflicting
# Two plugins contain the same function name so they're conflicting

(Asked by: username_0 on 2019-10-19)

I'm trying to use a filter function from a plugin, but it turns out two plugins that I have installed have the same function name and the wrong one is getting called. For now I edited the vendor files to rename the function, but I don't want that to be my final solution in case I want to upgrade the plugin later.

What is the best way to go about circumventing this type of conflict between two plugins?

**Tags:** craft3, plugins

> **Comments:**
> **username_1**: "same function name" - they have the same Twig filter function name?  
> **username_0**: @BradBell Yes they have the same Twig filter function name  

---

## 2 answers

### Answer by username_2 on 2019-10-23. Score: 1

You could get around this by creating your own renamed copies of those functions.

1. Create a module.
2. Copy the content of each affected plugin's twigextensions folder to your module's twigextensions folder.
3. Adjust the namespaces in these files to match your module
4. Rename the functions / filters in these files to something unique.
5. Load these twigextensions in your module's main file (`use` statement plus `Craft::$app->view->registerTwigExtension`).
6. You can now use the filters in twig by referencing the unique name you gave them.

If you haven't worked with modules before, you can use pluginfactory.io to scaffold a module that includes lots of example code, including all the required code to set up a twig extension.

To improve on this further, instead of a straight up copying of the twig extensions, refactor them to call the public functions in the original plugin files. This will ensure it's much less likely to break things when the plugin gets updated later.


---

### Answer by username_1 on 2019-10-22. Score: 0

If two plugins have a Twig filter/function that has an identical name, then whichever one "wins" will be the plugin that is loaded first (alphabetically, I believe).

No real way I can think of to get around it other than to contact the plugin developers and have one of them change the name.


---

