How to perform str_replace on the results of wp_list_pages
Change your $child in your code to $InnerPages, like this: $InnerPages = wp_list_pages(‘child_of=”.($post->post_parent != false ? $post->post_parent : $post->ID).”&title_li=&echo=0’); $InnerPages = str_replace(‘<ul class=”children”>’, ‘<ul class=”children”><li>Overview</li>’, $InnerPages); echo $InnerPages; You were saving your change in $child but then displaying $InnerPages which was unchanged. Additionally the class is children and not child and must match exactly to … Read more