I have some code in Wordpress that retrieves all Woocommerce product SKUs and is memory consuming (6000+ products)
So, at the start of my function I tried to increase the limit temporarily:
ini_set('memory_limit', '512M');
The result:
PHP Parse error: syntax error, unexpected 'M' (T_STRING), expecting ',' or ')'
I'm looking for an answer why this is wrong and I could not find it. Any ideas why this is happening?
PHP ini_set() as follow.
ini_set("memory_limit","512M");
OR
You can also try to change the memory_limit using either a php.ini or .htaccess file.
php.ini
memory_limit = 512M;
.htaccess
php_value memory_limit 512M
You can add this code in wp-config.php
define( 'WP_MEMORY_LIMIT', '512M' );