So I have a custom post type which uses ACF Metaboxes that contains over 750 posts and grwoing. I got the infamous white screen of death because it seems like PHP has exhaused it's memory limit querying all these posts and data. I set my PHP.INI file's max execution time and memory limit to -1
and increased my WP's memory limit in config to define('WP_MEMORY_LIMIT', '4096M');
yet I'm still receiving a white screen of death in the admin when trying to view the custom post type. Any ideas on how to fix/increase memory?
Thanks
So I have a custom post type which uses ACF Metaboxes that contains over 750 posts and grwoing. I got the infamous white screen of death because it seems like PHP has exhaused it's memory limit querying all these posts and data. I set my PHP.INI file's max execution time and memory limit to -1
and increased my WP's memory limit in config to define('WP_MEMORY_LIMIT', '4096M');
yet I'm still receiving a white screen of death in the admin when trying to view the custom post type. Any ideas on how to fix/increase memory?
Thanks
Share Improve this question asked May 30, 2014 at 19:53 RizzoRizzo 2696 silver badges20 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 1For me, this was happening b/c of post meta cache issues. This article suggested code which solved my issue - and apparently many other's as well.
https://junaid.dev/wordpress-admin-fix-fatal-error-allowed-memory-size-error/?unapproved=369&moderation-hash=bd9064ea40d413150d8a42599c13f4f5#comment-369
Here is the code he provides:
function jb_pre_get_posts( WP_Query $wp_query ) {
if ( in_array( $wp_query->get( 'post_type' ), array( 'my_post_type_1', 'my_post_type_2' ) ) ) {
$wp_query->set( 'update_post_meta_cache', false );
}
}
// Only do this for admin.
if ( is_admin() ) {
add_action( 'pre_get_posts', 'jb_pre_get_posts' );
}
wp-admin/edit.php?post_type=books
– Rizzo Commented May 30, 2014 at 20:38WP_DEBUG
enabled inwp-config.php
? What makes you think that PHP is exhausting it's memory limit; do you know this for sure or are you guessing? – bosco Commented May 30, 2014 at 20:44$wpdb->get_results()
method, which could well indicate that some query is returning an obscure amount of data. Do you haveWP_DEBUG
enabled inwp-config.php
? I would also enableWP_DEBUG_LOG
so any errors get logged into thewp-content
directory. Any WordPress-generated errors or warnings show up? I feel like this may have something to do with the internals of ACF Metaboxes which I'm entirely unfamiliar with, so I'm not sure how much more help I will be... – bosco Commented May 30, 2014 at 21:36