1

I am attempting to edit a specific page via the WordPress admin area while logged in as an Editor, however, the page dies with the following error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in [PATH]/htdocs/wp-includes/meta.php on line 841

This is only affecting this page, and granted, it is a very content heavy page, but attempting to edit the page as an Administrator works fine. Why might this be?

2 Answers 2

4

Because of this line in wp-admin/admin.php:

if ( current_user_can( 'manage_options' ) ) {
    wp_raise_memory_limit( 'admin' );
}

In other words, WordPress raises the memory limit to WP_MAX_MEMORY_LIMIT within the admin, but only for users with the manage_options capability i.e. administrators.

Your best bet is to raise the default memory limit in your wp-config.php:

define( 'WP_MEMORY_LIMIT', '256M' ); 
0

Probably you may try admin_init hook and call wp_raise_memory_limit( 'admin' ); for the selected user Example:

add_action('admin_init', function(){
   if (  get_current_user_id() === 111111 ){
       wp_raise_memory_limit( 'admin' );   
   }
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.