WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently working on a WordPress site and whenever in the admin I go the Appearance > Menus page I get the following error:

ErrorException: Runtime Notice: Declaration of Walker_Nav_Menu_Edit::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl() in wp-admin/includes/nav-menu.php line 203

It seems like some sort of PHP compatibility issue. I'm running PHP 5.3.10 on my local dev machine.

What would be the best way to remedy this problem?

share|improve this question
up vote 9 down vote accepted

From class Walker_Nav_Menu:

function start_lvl( &$output, $depth = 0, $args = array() )

Your child class must use the same signature: three arguments, the first one passed by reference. Every difference will raise the error you got.

Note that $args defaults to an empty array, but you get an instance of stdClass, not an array. This is WordPress.

share|improve this answer
I know. It's a WordPress class, it's not for me to change. My question is what's the best way to work around the problem (preferably without meddling with WP's internals)... – Luke Apr 9 '13 at 4:41
You are not being told to meddle with WordPress core. You need to alter the way you define your method in your extended class to match the way WordPress does it in the original class. – s_ha_dum Apr 9 '13 at 13:17
Got it. The error was throwing me off. It gave me the impression the problem was in WP core but it's referring to the definition of the signature, not where the problem occurred. – Luke Apr 9 '13 at 23:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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