[resolved] Custom Walker Menu $this Error (2 posts)

  1. ekazda
    Posted 2 years ago #


    I would like to create custom walker menu. I used example code in the documentation http://codex.wordpress.org/Function_Reference/wp_nav_menu#Example but it is producing a Fatal error: Using $this when not in object context in /....../wp-includes/class-wp-walker.php on line 192

    Anyone know why this might be occurring?

    Related: http://wordpress.org/support/topic/custom-walker-menu

    [Moderator note: the additional comments weren't necessary & were removed.]

  2. ekazda
    Posted 2 years ago #

    I was able to solve this problem. When calling wp_nav_menu, the walker needs to be called using the following code:

    'walker' => new Custom_Walker_Class

    I was not calling it this way (I was missing the new part) and I was receiving the error noted above. Hopefully this helps other unanswered posts.

Topic Closed

This topic has been closed to new replies.

About this Topic