25% off ProSNIPC25OFF

Increase PHP Memory Limit

Raises the PHP memory limit to 512 MB for WordPress requests, useful when heavyweight plugins exhaust the default allocation.

PHPby SnipCraft
php
<?php
// Raise the PHP memory_limit for this process.
// Note: the actual ceiling is set by your server's php.ini; ini_set can only
// increase the limit up to that ceiling, never above it.
@ini_set( 'memory_limit', '512M' );

// Also raise the WordPress-internal memory constants so core and plugins
// honour the higher limit when doing their own ini_set calls.
if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
    define( 'WP_MEMORY_LIMIT', '512M' );
}
if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
    define( 'WP_MAX_MEMORY_LIMIT', '512M' );
}
#maintenance#memory#performance#php