var_dump and print_r cause white screen
-
22-04-2021 - |
سؤال
My template is very simple:
get_header();
$new_p = get_posts(array('post_type' => 'post', 'numberposts' => 6));
get_footer();
whenever I put var_dump($new_p);
or print_r($new_p);
below $new_p = get_posts(array('post_type' => 'post', 'numberposts' => 6));
, it gives me the white screen.
Why on Earth would it do it??
This code is OK, though:
var_dump(wp_get_recent_posts(array('post_type' => 'tdlrm_store_item', 'numberposts' => 8), OBJECT));
Any ideas?
المحلول
Actually, memory was exhausted. Someone has copy-pasted an actual 2MB base64-encoded image into the post content, var_dump was trying to output it. Had to delete the image via PHPMyAdmin, because the WP editor won't open. Once it had been deleted, the problem was gone.
لا تنتمي إلى wordpress.stackexchange