removing tags from wp_list_pages() using PHP

You could try to remove them, but maybe it’s easier to not generate them in the first place. The page list is displayed by a Walker. This is a class that “walks” over all the items in the tree, and displays them. wp_list_pages() by default (via walk_page_tree()) uses the Walker_Page class, which displays everything in <li> elements. However, you can duplicate this class, remove everything it in you don’t need, and pass that class to wp_list_pages() (with the walker argument).

Leave a Comment