WordPress 6.2 and a fatal error: allowed memory size.

Last updated December 6th, 2023 00:32

The popular and widely used content management system WordPress received a major update to version 6.2 this week. And as with any major WordPress update, there have been quite a few issues. Well, to be precise, not with everyone. What I generally noticed is that the most problems occurred with memory exhaustion on shared hosting, where php.ini cannot be modified. So what to do after updating to WordPress 6.2 and a fatal error: allowed memory size?

WordPress 6.2 and a fatal error: allowed memory size. What actually happened?

fatal error: allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /web/htdocs/www.mojedomena.cz/home/www/wp-includes/plugin.php on line 203

Simply put, every hosting has a certain amount of memory allocated to it, called the memory limit. Each plugin, WordPress itself, and the theme takes a portion of this memory. However, after updating to WordPress 6.2, many people exhausted this memory due to incompatibility with the new version of WordPress and other content. As a result, WordPress can no longer function and ends up with a fatal error.

To address this error, the first thing you should do is to check the WordPress revisions.

WordPress revisions serve as the first point of focus. You can learn more about WordPress revisions and their usage here: What is revision in WordPress? It’s possible that your WordPress site already has a large number of revisions, which could be the reason why the new version of the system crashed. If you don’t periodically delete revisions, their number increases significantly and can eventually lead to memory problems. Therefore, it’s likely that revisions are the cause of the memory problem that occurred after upgrading to version 6.2. If you have access to WordPress administration, you can follow my guide and use the Sweep plugin.

If you don’t have access to administration, you can delete revisions directly in the database using the PhpMyAdmin tool. You’ll need to execute this command:

				
						
DELETE FROM wp_posts WHERE post_type = "revision";
				
			
WordPress 6.2 and a fatal error: allowed memory size

How to fix the fatal error: allowed memory size?

There are two possible ways to fix this problem, depending on whether you can increase memory or not. In general, this can only be done on your own server, where you have access to the php.ini file. On shared hosting, memory is typically set and cannot be changed. If you have the option, increasing memory can be a solution to the problem. It’s only a partial solution, but it will solve the problem. However, it won’t address the underlying cause.

You can increase the memory limit by editing the php.ini file or the .htaccess file (if allowed). In php.ini, you can do this by increasing the value in the file, for example from 256 to 512.

Where do you find the php.ini file?

WordPress 6.2 a fatal error: allowed memory size.

If allowed on the server, you can increase the memory limit in the .htaccess file by adding the following directive:

				
					php_value memory_limit 512M
				
			

I must note that increasing the memory limit through the .htaccess file must be allowed. It may be a directive that is disabled and can cause problems.

How to fix this error on a shared hosting where increasing the memory limit is not possible?

On shared hosting, you usually don’t have the option to increase the memory limit. So what can you do here? To be honest, not much. The only solution is to restore WordPress from a backup (FTP and MySQL) and disable automatic updates. If you don’t disable the updates, WordPress will perform the update to version 6.2 again within a few minutes and you’ll end up with the same error. Disabling updates is done through the wp-config.php file, which you can access via FTP. It’s located in the root directory of WordPress and is the configuration file. Insert this line into it:”

				
					define( 'WP_AUTO_UPDATE_CORE', false );
				
			

If you would like to disable plugin and theme updates as well, add these lines:

				
					add_filter( 'auto_update_plugin', '__return_false' );
				
			
				
					add_filter( 'auto_update_theme', '__return_false' );
				
			

WordPress 6.2 and fatal error: allowed memory size. How to prevent it?

Here are a few points to keep in mind:

  • Be mindful of the plugins you install and don’t try to solve every problem with a new plugin.
  • Always check the date of the last plugin update. If a plugin hasn’t been updated in a long time, it may cause problems in the new version.
  • Pay attention to themes and choose ones with a wide user base and active developer communication.
  • Regularly back up your website and database.

If you do encounter such an error on your website and are forced to restore it from a backup, it’s good to identify where the problem originated. First, try changing the theme temporarily. It’s best to use a WordPress default theme to rule out the possibility of a memory issue with an unsupported theme.

If the problem isn’t with the theme, you’ll need to investigate the plugins. So, focus on the plugins you’re using and the version of WordPress they are tested with. Additionally, check when the developer last updated them. Replace outdated plugins with alternatives that the developer maintains.

Conclusion

As you can see from the above, it’s often possible to prevent the problem by installing plugins that are prepared for the new version. The same goes for themes. A plugin that hasn’t been tested on the latest version you’re using will likely have an issue, and the developer may not respond or may not be responsive enough. With verified plugins and themes, where the developer tests on a beta version of the new WordPress, you have at least the basic certainty that problems will be eliminated when the new WordPress version is released. The problem may not even arise.

More content about WordPress

Whole category is here

The website is created with care for the included information. I strive to provide high-quality and useful content that helps or inspires others. If you are satisfied with my work and would like to support me, you can do so through simple options.

Byl pro Vás tento článek užitečný?

Klikni na počet hvězd pro hlasování.

Průměrné hodnocení. 0 / 5. Počet hlasování: 0

Zatím nehodnoceno! Buďte první

Jak užitečný vidíte tento článek.

Sledujte mě na sociálních médiích.

Je mi líto, že pro Vás nebyl článek užitečný.

Jak mohu vylepšit článek?

Řekněte mi, jak jej mohu zlepšit.

newsletter

Subscribe to the Newsletter

Stay informed! Join our newsletter subscription and be the first to receive the latest information directly to your email inbox. Follow updates, exclusive events, and inspiring content, all delivered straight to your email.

Odebírat
Upozornit na
guest
0 Komentáře/ů
Nejstarší
Nejnovější Nejvíce hlasováno
Vložené zpětné vazby.
Zobrazit všechny komentáře.

Pokud mi chcete napsat rychlou zprávu, využije, prosím, níže uvedený
kontaktní formulář. Děkuji.

Další Kontaktní údaje