WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ekazda
    Member
    Posted 2 months ago #

    Hi,

    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
    Member
    Posted 2 months 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.

Reply

You must log in to post.

About this Topic