Title: Replace text from wp_list_pages
Last modified: January 19, 2017

---

# Replace text from wp_list_pages

 *  [andrewkusuma](https://wordpress.org/support/users/andrewkusuma/)
 * (@andrewkusuma)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/replace-text-from-wp_list_pages/)
 * I create display list of parent and their child page use this code
 *     ```
       function my_list_child_pages() {
         if (is_page()) {
           global $post;
           $args = 'echo=0&sort_column=menu_order&title_li=';
           // Check whether page is parent/child page
           $page = ($post->post_parent) ? $post->post_parent : $post->ID;
           $parent   = wp_list_pages( $args.'&include='.$page );
           $children = wp_list_pages( $args.'&child_of='.$page );
           // If the current page has/is child page
           $list = ($children) ? '<ul class="disease-nav">'.$parent.$children.'</ul>' : '';
         }
         return $list;
         }
   
       add_shortcode('wpb_childpages', 'my_list_child_pages');
       ```
   
 * Page A
    – Page A1 – Page A2
 * output:
    Page A Page A1 Page A2
 * I want to replace text output Page A without edit title from wp-admin. I want
   to result is
    Overview Page A1 Page A2
 * Anyone ever create function like that?
 * Thanks

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/replace-text-from-wp_list_pages/#post-8675338)
 * I would use preg_replace() to replace whatever title exists in $parent with “
   Overview”. The title is always within the anchor tags. The regexp would break
   up the search string into 3 parts, the middle being the title text. The replacement
   would back reference the beginning and ending parts of the regexp with “Overview”
   in between. If you struggle with regexp (who doesn’t?), a “fiddle” tool for regexp
   is very useful. One example: [http://www.regexr.com/](http://www.regexr.com/)

Viewing 1 replies (of 1 total)

The topic ‘Replace text from wp_list_pages’ is closed to new replies.

## Tags

 * [pages](https://wordpress.org/support/topic-tag/pages/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/replace-text-from-wp_list_pages/#post-8675338)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
