WP Discourse Plugin Error

AI-generated summary

A user reports that their site crashes after updates due to a missing trait error in the WP Discourse plugin, specifically the PluginUtilities trait not being found in utilities.php. The user fixes it by including the plugin-utilities.php file. angus explains that the issue likely stems from the plugin not being loaded properly and the Utilities class not being used correctly, suggesting the user may have custom code using the class. The user confirms that including the file in their code snippet resolves the issue ti0.

Every time I update my site crashes because of an error in the 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:


l

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.

Your issue may be that the 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 Utilities? Is the WP Discourse plugin currently “Activated”?

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