Support » Plugins and Hacks » Hacks » Custom Walker Menu $this Error
2 years, 8 months 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?
[Moderator note: the additional comments weren’t necessary & were removed.]
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.