hope to find a solution here.

After having updated out php to PHP 8.0, we are having DEPRECATED alert. Most of them regards a required parameter that follows an optional one (making the second as required as the first). I've changed it in the related file .php and alerts are gone. Expect for the following that is driving me crazy:

Required parameter $args follows optional parameter $depth in

When I try to fix it, changing the order a fatal error occurs:

Declaration of Nectar_Arrow_Walker_Nav_Menu::display_element($element, &$children_elements, &$output, $max_depth, $depth, $args) must be compatible with Walker::display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)*

It seems that I can not replace the optional with the required one since they are needed in the basic theme function. But without doing it, the alert occurs.

I've also tried to drop the default value off, same outcome though.

Can someone help me? Thank you in advance!!


1 Answer 1


Nectar_Arrow_Walker_Nav_Menu apparently extends the WordPress Walker class. This means that its methods' arguments need to match the original class methods' arguments:

public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {}

The WordPress class doesn't have any optional parameters so it doesn't have this issue. Make sure your method's arguments match WordPress' and don't make any of them optional.

  • Thank you for your answers.So it seems that the issue is the Nectar_Arrow_Walker_Nav_Menu. I should replace it with the WordPress Walker class in order not to have it anymore Is it correct? Jan 24 at 11:21
  • No, that's not correct. If you're not sure what to do, contact the theme author for support. Also, pease don't post comments as answers. This should be a comment on my answer. Jan 24 at 11:30
  • @FedericaCilli if you login with the same account that created the question you can reply with a comment, don't reply by posting a solution again though or you might get auto-banned by the site as a spammer.
    – Tom J Nowell
    Jan 24 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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