WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm just analyzing my custom Walker Class because it frequently skips over some post_meta data that I append to the $output HTML.

Even though the Custom Fields are set, they are ignored by the Walker. They are only shown when I go back to my functions.php, and re-run the function that sets the Custom Fields.

The extract function is used to obtain the arguments and skips over the arguments with the new ones provided in the walker.

invalid/numeric keys and collisions are Skipped in this case, so I would assume that my Custom Walker is being run each time.

I'll give an example of how it obtains the Custom Field:

$CommentCount = get_post_meta($page->ID, 'num_comments_in_Tree', true);
        $CommentCount = "";
    }else{$CommentCount = '&nbsp;<span style="font-size:.75em">
    comments: (' . get_post_meta($page->ID, 'num_comments_in_Tree', true)
    . ')</span>&nbsp;';}

    $MetaOutput = $CountChildren . $PageLastModifiedDate . 
    $CommentCount . $LastCommentDate . $Description;

    $output .= $indent . 
                '<li><div class="link"><a href="' . get_page_link($page->ID) . '" title="' . 
                esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . '">' . 
                $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>' . $MetaOutput . '</div>';

^See the end of the last line for the $MetaOutput.

I don't know why, if the Custom Fields are set on each page, they will only show if I re-run the function that sets the Custom Fields.

share|improve this question
up vote 0 down vote accepted

I ended up running the function twice on itself. That way, once the walker updated the last element, it went back up to the top to update the first.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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