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 trial

WordPress WordPress Theme Development WordPress Header and Footer Templates Porting existing headers and footers into WordPress

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

Receiving a strange error when adding in wp_head();.

When I add in the wp_head(); function in place of the stlye and JS links I get this strange error.

Fatal error: Maximum function nesting level of '100' reached, aborting! in /Users/jeff/Documents/Websites/www.sandbox.dev/wp-includes/cache.php on line 511

I can't figure this out for the life of me. Someone please help.

3 Answers

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

I figured it out now. I should have posted a screenshot of the error message. I was calling wp_enqueue_scripts instead of wp_enqueue_script. This resulted in the page calling that hook over and over again.

This brings up a bigger question, is there a way to attach screenshots here?

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

Nice, glad you got it :)

No file uploads, but you can embed an image uploaded somewhere using markdown :)

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

Cool, thanks for you help Zac.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Can you post up your code please

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

This is the code in my header.php file. It breaks as soon as I put the wp_heade(); in.

<!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php wp_title(); ?></title>

<?php wp_head(); ?>

</head>

<body> <header class="row no-max pad main"> <h1><a class='current' href="index.html">G</a></h1> <a href="" class="nav-toggle"><span></span>Menu</a> <nav> <h1 class="open"><a class='current' href="index.html">G</a></h1> <ul class="no-bullet"> <li class="current parent"><a class='current' href="index.html">Portfolio</a> <ul class="sub-menu"> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> </ul> </li> <li class="parent"><a href="blog.html">Blog</a> <ul class="sub-menu"> <li><a href="single-post.html">Single Post</a></li> <li><a href="author.html">Author Page</a></li> </ul> </li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </header>

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

I'm not seeing the wp_head() code included here.

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

It is right under title and above the <header class="row no-max pad main">. For some reason the comments section broke up my code into two separate blocks. It is in the first block.