wp warning declaration compatible [closed]

Lets say that you’re a cook, and I tell you in order to pass a test you have to make:

  • 3 cakes
  • 1 pie
  • 7 cookies

And you come back to me with 4 cakes and a pie, those don’t match, you failed the test.

The same thing is happening in your code:

Warning: Declaration of kiddy_Walker_Nav_Menu::walk($items, $depth) should be compatible with Walker::walk($elements, $max_depth, …$args) in /var/www/html/eeicurumim.com.br/web/wp-content/themes/kiddy/functions.php on line 3002

kiddy_Walker_Nav_Menu inherits from Walker but it has a mismatching incompatible function inside it.


So lets pick it apart, as it outright tells you what the problem is

kiddy_Walker_Nav_Menu::walk($items, $depth) should be compatible with Walker::walk($elements, $max_depth, …$args)

Here’s the problem, notice the parameters don’t match, they must match. $items, $depth and $elements, $max_depth, ...$args are not the same.

in /var/www/html/eeicurumim.com.br/web/wp-content/themes/kiddy/functions.php on line 3002

Is just telling you which file the issue is in, and which line of the file it happens.

So how do you fix it?

You make them match. You need to accept 3 things, a set of items, a max depth, and some arguments. But your version doesn’t do that, so start by adding , ...$args