Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn Nichols
1,451 Pointswp_head(); is causing memory error.
wp_head() is causing this error: "Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) in /Users/jn/Sites/localwp.com/wp-includes/class-wp-hook.php on line 291"
The error only starts when I add that line.
I have already tried:
Changing "define( 'WP_MEMORY_LIMIT', '256M' );" in wp-config.php and Changing "memory_limit = 256M" in MAMP>bin>php>php7.0.15(version I'm using)>conf>php.ini
I'm completely out of ideas.
My functions.php:
<?php
function wpt_theme_styles() {
wp_enqueue_style('foundation_css', get_template_directory_uri() . '/css/foundations.css');
wp_enqueue_style('normalize_css', get_template_directory_uri() . '/css/normalize.css');
wp_enqueue_style('normalize_css', 'http://fonts.googleapis.com/css?family=ASAP:400,700,400italic,700italic');
wp_enqueue_style('main_css', get_template_directory_uri() . 'style.css');
}
add_action('wp_enqueue_scripts', 'wpt_theme_styles');
function wpt_theme_js() {
wp_enqueue_scripts('modernizr_js', get_template_directory_uri() . '/js/modernizr.js', '', '', false);
wp_enqueue_scripts('foundation_js', get_template_directory_uri() . '/js/foundation.js', array('jquery'), '', true);
wp_enqueue_scripts('main_js', get_template_directory_uri() . '/js/app.js', array('jquery', 'foundation_js'), '', true);
}
add_action('wp_enqueue_scripts', 'wpt_theme_js');
?>
1 Answer
Mark Truitt
17,230 PointsI would deactivate any/all plugins and go one at a time. I have run into this issue with poorly written plugins in the past.
Though sometimes it is due to the memory limit being low.
Did you confirm that the limit did in fact increase to 256? On the server level you generally need to restart it for the setting change to take affect?