Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()

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.

Leave a Comment