# WP Discourse Plugin Error

**URL:** https://meta.discourse.org/t/wp-discourse-plugin-error/250409
**Category:** WordPress
**Created:** [January 2, 2023, 2:19pm UTC](https://meta.discourse.org/t/wp-discourse-plugin-error/250409 "2023-01-02T14:19:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ti0](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ti0/32/184402_2.png) [@ti0](https://meta.discourse.org/u/ti0)
#### Post date: [January 2, 2023, 2:19pm UTC](https://meta.discourse.org/t/wp-discourse-plugin-error/250409/1 "2023-01-02T14:19:27Z")

</div>

Every time I update my site crashes because of an error in the [WP Discourse](https://github.com/discourse/wp-discourse) plugin. I have learned to fix it myself but it would be great if I didn’t have to after every update.

The `lib/plugin-utilities.php` file needs to be included in the`'lib/utilities.php` file, otherwise it gives the error:

`Trait 'WPDiscourse\Shared\PluginUtilities' not found in .../public/wp-content/plugins/wp-discourse/lib/utilities.php on line 17`

I am not sure if this is because of my setup or others are facing this as well. I am running php7.4.

My fix is just to include the file before that line:  
In `lib/utiities.php`:

 ![Screenshot 2023-01-02 at 11.18.12](https://global.discourse-cdn.com/meta/original/4X/5/b/7/5b7ae5d85a905458547f0981f6c1d2dcaeab27f3.png)  
l

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [January 3, 2023, 9:41pm UTC](https://meta.discourse.org/t/wp-discourse-plugin-error/250409/2 "2023-01-03T21:41:06Z")

</div>

This is related to your setup, as the `Utilities` class does in fact `use` the `PluginUtilities` trait (you can see it in your screenshot there), which is `required` [elsewhere in the plugin](https://github.com/discourse/wp-discourse/blob/main/wp-discourse.php#L42).

Your issue may be that the [WP Discourse](https://github.com/discourse/wp-discourse) plugin is not being loaded properly and you’re attempting to use the `Utilities` class in a code snippet. Do you have any custom code using [WP Discourse](https://github.com/discourse/wp-discourse) `Utilities`? Is the [WP Discourse](https://github.com/discourse/wp-discourse) plugin currently “Activated”?

---

<div class="post-metadata">

### Author: ![ti0](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ti0/32/184402_2.png) [@ti0](https://meta.discourse.org/u/ti0)
#### Post date: [January 4, 2023, 1:02pm UTC](https://meta.discourse.org/t/wp-discourse-plugin-error/250409/3 "2023-01-04T13:02:32Z")

</div>

Yes that was it, I included it in the code snippet and that fixed the issue. Thanks a lot!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 3, 2023, 1:03pm UTC](https://meta.discourse.org/t/wp-discourse-plugin-error/250409/4 "2023-02-03T13:03:15Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
