plugins - updraft plus migrator problem

admin2025-06-02  3

This question already has answers here: Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl() (3 answers) Closed 6 years ago.

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\wp-content\themes\mysite\functions.php on line 295

This question already has answers here: Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl() (3 answers) Closed 6 years ago.

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\wp-content\themes\mysite\functions.php on line 295

Share Improve this question asked Feb 24, 2019 at 10:02 George PolitisGeorge Politis 31 bronze badge 0
Add a comment  | 

1 Answer 1

Reset to default 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\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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748872032a314419.html

最新回复(0)