# Plugin load order?

**URL:** <https://forum.getkirby.com/t/plugin-load-order/1701>\
**Category:** Questions\
**Tags:** v2\
**Created:** [July 28, 2015, 7:21am UTC](https://forum.getkirby.com/t/plugin-load-order/1701 "2015-07-28T07:21:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [July 28, 2015, 7:21am UTC](https://forum.getkirby.com/t/plugin-load-order/1701/1 "2015-07-28T07:21:26Z")

</div>

Let’s say I have these plugins…

```
custom-plugin
test-plugin

```

Now the “test-plugin” is like a core plugin and the “custom-plugin” is more of a configuration plugin with custom functions.

### Plugin name desides load order

“custom-plugin” is loaded before “test-plugin”. In this case it will be a problem because “custom-plugin” uses functions from “test-plugin”.

Is there a way to manage the plugin load order? I can rename the plugin but I don’t feel it should be desided by its name?

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [July 28, 2015, 10:47am UTC](https://forum.getkirby.com/t/plugin-load-order/1701/2 "2015-07-28T10:47:55Z")

</div>

You can load your plugin dependencies from within the plugin that needs it:

```php
$returnValue = kirby()->plugin('test-plugin');

```

The `test-plugin` plugin won’t be loaded again later, so using that function as often as you need doesn’t cause any problems. The return value is stored for later use.

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [July 28, 2015, 11:00am UTC](https://forum.getkirby.com/t/plugin-load-order/1701/3 "2015-07-28T11:00:42Z")

</div>

Very simple, clever and it worked out of the box.

I’m also very impressed about your knowlage about code and Kirby. You often have awesome answers to hardcore questions. Thanks!

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [July 28, 2015, 11:22am UTC](https://forum.getkirby.com/t/plugin-load-order/1701/4 "2015-07-28T11:22:17Z")

</div>

> [@jenstornell](#):
>
> I’m also very impressed about your knowlage about code and Kirby. You often have awesome answers to hardcore questions. Thanks!

Thanks a lot! 😊  
Since I’m regularly helping developing Kirby in my spare time for I guess three years now, I have been digging through the Kirby code a lot. 😉

---

<div class="post-metadata">

**Author:** ![flokosiol](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/flokosiol/32/468_2.png) [@flokosiol](https://forum.getkirby.com/u/flokosiol)\
**Post date:** [July 29, 2015, 7:05am UTC](https://forum.getkirby.com/t/plugin-load-order/1701/5 "2015-07-29T07:05:31Z")

</div>

Lukas is the Best-le 😜

[… sorry for that spam post]

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [July 29, 2015, 8:09am UTC](https://forum.getkirby.com/t/plugin-load-order/1701/6 "2015-07-29T08:09:52Z")

</div>

Glad you don’t know how often I have heard this joke in both English and German. 😃

---

<div class="post-metadata">

**Author:** ![Microman](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/microman/32/15876_2.png) [@Microman](https://forum.getkirby.com/u/Microman)\
**Post date:** [March 6, 2023, 11:31am UTC](https://forum.getkirby.com/t/plugin-load-order/1701/7 "2023-03-06T11:31:56Z")

</div>

Is there also a workaround to init the own plugin before all the others?

---

<div class="post-metadata">

**Author:** ![bnomei](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bnomei/32/775_2.png) [@bnomei](https://forum.getkirby.com/u/bnomei)\
**Post date:** [March 9, 2023, 6:14pm UTC](https://forum.getkirby.com/t/plugin-load-order/1701/8 "2023-03-09T18:14:39Z")

</div>

its alphabetically so maybe just use `_myplugin` as a folder name or `aaaa_myplugin`?

---

<div class="post-metadata">

**Author:** ![bnomei](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bnomei/32/775_2.png) [@bnomei](https://forum.getkirby.com/u/bnomei)\
**Post date:** [March 9, 2023, 6:15pm UTC](https://forum.getkirby.com/t/plugin-load-order/1701/9 "2023-03-09T18:15:58Z")

</div>

and there is this

> **[Plugin Loader](https://getkirby.com/plugins/afbora/plugin-loader)**
>
> With Kirby Loader you can load plugins from multiple roots. Thus, you can simplify the management of your plugins by grouping.

---

<div class="post-metadata">

**Author:** ![Microman](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/microman/32/15876_2.png) [@Microman](https://forum.getkirby.com/u/Microman)\
**Post date:** [March 12, 2023, 10:13am UTC](https://forum.getkirby.com/t/plugin-load-order/1701/10 "2023-03-12T10:13:42Z")

</div>

Nice! Thank you. 🤗

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:22pm UTC](https://forum.getkirby.com/t/plugin-load-order/1701/11 "2025-02-06T17:22:54Z")

</div>


