Menu adicional

Obtenha o MemberPress hoje mesmo! Comece a ser pago pelo conteúdo que você cria! Obtenha o MemberPress agora

How to Fix the Trait Not Found Error After Updating MemberPress

After a MemberPress update, a website can crash and show a fatal PHP error. The error states that a trait or class within the MemberPress\GroundLevel namespace was not found.

The error comes from the server's cache, not from MemberPress itself. It does not indicate lost or damaged data. All memberships, members, and settings remain safe in the database.

This document explains what causes the error and how to fix it. The solutions range from a page reload to a short request to the hosting provider.

Entendendo o erro

After a MemberPress update, the website can show the “There has been a critical error on this website.” message. The related fatal error appears in the WordPress debug log:

PHP Fatal error: Trait "MemberPress\GroundLevel\Container\Concerns\InjectsDependencies" not found in /home/username/public_html/wp-content/plugins/memberpress/app/lib/MeprAddonUpdates.php on line 19

WordPress also sends an email about the critical error to the website's admin email address. There, the same error looks like this:

An error of type E_ERROR was caused in line 15 of the file /home/username/public_html/wp-content/plugins/memberpress/app/controllers/MeprFeatureAddonCtrl.php. Error message: Trait "MemberPress\GroundLevel\Container\Concerns\InjectsDependencies" not found

The exact file name, line number, and trait or class name can differ between websites. All variants of the error have the same cause and the same solution.

Observação: An error message mentioning “Cannot resolve parameter” has a different cause. This document does not cover that error. In that case, contact the Equipe de suporte da MemberPress directly.

What Causes the Error

Most servers use OPcache, a PHP feature that keeps copies of the website's code in memory. This helps pages load faster because the server does not need to read each file again on every visit.

During an update, MemberPress replaces its files on the server. WordPress then asks the server to refresh the stored copies. However, some server setups block or skip this refresh.

When that happens, the server keeps using an outdated list of the plugin's files. The new files from the update are missing from this list. As a result, PHP cannot find them, and the fatal error appears.

The same server behavior can affect any WordPress plugin or theme update. The solution is to make the server load the new files.

Observação: Updates run through WP-CLI can also trigger this error. The command line and the web server use separate caches. The update refreshes one cache, while the other stays outdated.

Solution 1: Reload the Website

In many cases, the error is temporary. The server refreshes its cache on its own within a few minutes after the update.

Wait a few minutes, then reload the website. If the error is still there, continue to the next solution.

Solution 2: Reinstall the MemberPress Update

Reinstalling the plugin writes all MemberPress files to the server again. In most cases, this makes the server drop the outdated copies. Follow these steps:

  1. Download the latest MemberPress .zip file do Downloads tab of your Conta MemberPress.
  2. Faça login em seu site e navegue até Dashboard > Plugins > Add New Plugin.
  3. Clique no botão Plug-in de upload button, click Selecionar arquivo, and select the downloaded .zip file.
  4. Clique em Instalar agora.
  5. Na próxima página, clique no botão Substituir atual por carregado botão.

This process reinstalls the plugin without affecting any MemberPress data. The Atualização do MemberPress document describes the manual update process in more detail.

Observação: The fatal error can block access to the WordPress dashboard. In that case, use the recovery mode link from the critical error email. Alternatively, replace the /wp-content/plugins/memberpress/ folder over FTP with the folder from the downloaded .zip file. Users who cannot use FTP can move directly to the hosting provider solution. The host can fix the error with no steps needed on the website.

Check the website after the reinstallation. If the error is still there, continue to the next solution.

Solution 3: Clear the Server OPcache

On some servers, reinstalling the files does not refresh the cache. In that case, the cache needs a manual reset.

Many hosting control panels include an option to clear the PHP cache or restart PHP. The option's name and location depend on the hosting provider. Look for options labeled “Flush PHP OPcache”, “Clear PHP Cache”ou “Restart PHP”. Restarting PHP also clears the whole cache.

Clear the cache, then reload the website. If the error remains, or no such option exists, contact the hosting provider.

Solution 4: Contact the Hosting Provider

The hosting provider can reset the cache directly on the server. This solution needs no technical steps. It also works when the fatal error blocks the WordPress dashboard.

The following message template describes the issue to the hosting support team:

Hello,

After a plugin update, my website shows a PHP fatal error stating that a
trait or class was not found. The updated plugin files are present on the
disk. However, OPcache is serving stale cached copies of some files.

Could you please flush the PHP OPcache for my account, or restart PHP
(PHP-FPM)?

Please also check whether opcache.restrict_api or
opcache.validate_timestamps=0 is set on my server. These settings prevent
WordPress from refreshing cached files automatically during plugin
updates. Adjusting them would prevent this issue after future updates.

Thank you.

After the host resets the cache, the website loads the new plugin files, and the error disappears. If the error remains after the cache reset, contact the Equipe de suporte da MemberPress for further assistance.

What Will Not Usually Fix This Error

The error comes from the server's PHP cache. Therefore, the following common troubleshooting steps will not usually fix it:

  • clearing the browser cache, since the browser does not store the error;
  • clearing page caching plugins (e.g. WP Rocket, W3 Total Cache), since these plugins store pages, not PHP files;
  • clearing the CDN cache (e.g. Cloudflare), for the same reason;
  • deactivating and reactivating MemberPress, since this does not write the plugin files again;
  • repairing or restoring the database, since the database does not cause the error.

Skipping these steps saves time and prevents unneeded changes to the website.

Este artigo foi útil?

Artigos relacionados

garota do computador

Obtenha o MemberPress hoje mesmo!

Comece a ser pago pelo conteúdo que você cria.