0

Hello guys i get the warning below when i am running mysite locallyl. Do you have any idea what causes this??

Warning: Declaration of Walker_Quicklinks_Menu::start_lvl(&$output, $item, $depth = 0, $args = Array, $id = 0) should be compatible with Walker::start_lvl(&$output, $depth = 0, $args = Array) in C:\Users\User\Desktop\www.sto.dev.cc\wp-content\themes\mysite\functions.php on line 295

0

Well, I'm not sure what your Walker_Quicklinks_Menu class is (presumably a plugin you are using?), but I can help you understand the PHP error message. I am assuming in your functions.php file you are attemping to use the Walker_Quicklinks_Menu class, not extend it.

Warning: Declaration of Walker_Quicklinks_Menu::start_lvl(&$output, $item, $depth = 0, $args = Array, $id = 0) should be compatible with Walker::start_lvl(&$output, $depth = 0, $args = Array) in C:\Users\User\Desktop\www.sto.dev.cc\wp-content\themes\mysite\functions.php on line 295

So bit by bit:

Declaration of Walker_Quicklinks_menu::start_level

When the "start_level" function inside of the "Walker_Quicklinks" class is declared...

(&$output, $item, $depth = 0, $args = Array, $id = 0)

it receives $output and $item, and optionally a $depth number, an $args argument, and an $id number

should be compatible with Walker::start_lvl

and that should match the format of how you are trying to use it

(&$output, $depth = 0, $args = Array)

when you are sending it $output, $depth, and $args

Basically in the plugin (or wherever Walker_Quicklinks lives) that function takes 5 arguments, 3 of which are optional. It always takes them in that exact order.

When you are using it, you are skipping the second argument and therefore providing the third in it's place. It doesn't match.

You are also attempting to provide default values (i.e. $depth = 0, $args = Array) but you only do this when the function is defined, not when it's used. If you want to use the default values when you are using it, just leave them off.

TL;DR go into your functions.php file, and on line 295 change your function call to match what the plugin/class expects. The first parameter should be the $output, the second should be the $item, and the rest you can leave off.

  • class Walker_Quicklinks_Menu extends Walker { var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' ); function start_lvl( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { } function end_lvl( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { } function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {$output .= sprintf( "<option value='%s'>%s</option>\n", $item->url, $item->title ); } function end_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { } } – George Politis Feb 25 '19 at 1:20
  • Thank you !!! you are awesome!!!! i found the solution!!!! You helped me out!!! The beers on me!!! Than u again!!! – George Politis Mar 23 '19 at 10:27

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