Title: Add echo = false to shortcode_atts
Last modified: September 11, 2020

---

# Add echo = false to shortcode_atts

 *  Resolved [Gabriel Serafini](https://wordpress.org/support/users/gserafini/)
 * (@gserafini)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/add-echo-false-to-shortcode_atts/)
 * I really like this plugin, thank you for writing it. A simple thing I know, but
   very useful. At some point, they added an `echo` flag (defaulted to true) to 
   the [`wp_list_pages` function](https://developer.wordpress.org/reference/functions/wp_list_pages/).
 * This results now in the contents of the shortcode getting outputted at the top
   of the post or page it’s being used in, rather than in the correct place the 
   shortcode was placed.
 * Adding this to the plugin code `shortcode_atts` fixes it:
 * `'echo' => false,`
 * Please consider adding this to the plugin so it’s available for everyone.
 * Thanks!
 * Complete function here:
 *     ```
        public function subpage_view($atts)
               {
               global $wp_query;
   
                       return wp_list_pages(shortcode_atts(array(
                               'depth'        => 0,
                               'show_date'    => '',
                               'date_format'  => get_option('date_format'),
                               'child_of'     => $wp_query->queried_object->ID,
                               'exclude'      => '',
                               'title_li'     => '',
                               'authors'      => '',
                               'sort_column'  => 'menu_order, post_title',
                               'link_before'  => '',
                               'link_after'   => '',
                   'exclude_tree' => '',
                   'post_type'    => 'page',
                   'post_status'  => 'publish',
                   'item_spacing' => 'preserve',
                   'walker'       => '',
                   'echo' => false,
                       ), $atts));
               }
       ```
   
    -  This topic was modified 5 years, 9 months ago by [Gabriel Serafini](https://wordpress.org/support/users/gserafini/).
      Reason: Added suggested fix in context

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [urlund](https://wordpress.org/support/users/codework/)
 * (@codework)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/add-echo-false-to-shortcode_atts/#post-13474629)
 * Hi,
 * Thank you for your msg. Plugin has been updated, hope you like it 🙂
 *  Thread Starter [Gabriel Serafini](https://wordpress.org/support/users/gserafini/)
 * (@gserafini)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/add-echo-false-to-shortcode_atts/#post-13476585)
 * Awesome, thank you so much!!
 *  Plugin Author [urlund](https://wordpress.org/support/users/codework/)
 * (@codework)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/add-echo-false-to-shortcode_atts/#post-13492781)
 * Out of context, I know – but you made me realize it has been a while since I 
   released this plugin, so I thought it needed some love – so I’ve added a widget
   😉
 *  Thread Starter [Gabriel Serafini](https://wordpress.org/support/users/gserafini/)
 * (@gserafini)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/add-echo-false-to-shortcode_atts/#post-13494687)
 * Nice! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Add echo = false to shortcode_atts’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/subpage-view_0e120a.svg)
 * [Subpage List](https://wordpress.org/plugins/subpage-view/)
 * [Support Threads](https://wordpress.org/support/plugin/subpage-view/)
 * [Active Topics](https://wordpress.org/support/plugin/subpage-view/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/subpage-view/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/subpage-view/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Gabriel Serafini](https://wordpress.org/support/users/gserafini/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/add-echo-false-to-shortcode_atts/#post-13494687)
 * Status: resolved