Title: [Quick fix] Debug_Bar_WP_Query::render array to string notice
Last modified: August 21, 2016

---

# [Quick fix] Debug_Bar_WP_Query::render array to string notice

 *  [Gregory Karpinsky (@tivnet)](https://wordpress.org/support/users/tivnet/)
 * (@tivnet)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/quick-fix-debug_bar_wp_queryrender-array-to-string-notice/)
 * Serialize the $value:
 *     ```
       if ( is_object( $value ) ) {
       	echo '<li>' . $key . ' => <ol>';
       	foreach ( $value as $_key => $_value )
       		echo '<li>' . $_key . ' => ' . $_value . '</li>';
       	echo '</ol></li>';
       } else {
       	echo '<li>' . $key . ' => ' . maybe_serialize( $value ) . '</li>';
       }
       ```
   
 * [https://wordpress.org/plugins/debug-bar/](https://wordpress.org/plugins/debug-bar/)

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

 *  Thread Starter [Gregory Karpinsky (@tivnet)](https://wordpress.org/support/users/tivnet/)
 * (@tivnet)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/quick-fix-debug_bar_wp_queryrender-array-to-string-notice/#post-4630336)
 * Or this way:
 *     ```
       if ( ! is_scalar( $value ) ) {
       	echo '<li>' . $key . ' => <ol><li><xmp>';
       	print_r( $value );
       	echo '</xmp></li></ol></li>';
       }
       else {
       	echo '<li>' . $key . ' => ' . $value . '</li>';
       }
       ```
   
 *  [Ben Huson](https://wordpress.org/support/users/husobj/)
 * (@husobj)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/quick-fix-debug_bar_wp_queryrender-array-to-string-notice/#post-4630555)
 * Or more useful, use print_r?
 *     ```
       if ( is_object( $value ) ) {
       	echo '<li>' . $key . ' => <ol>';
       	foreach ( $value as $_key => $_value )
       		echo '<li>' . $_key . ' => ' . $_value . '</li>';
       	echo '</ol></li>';
       } else {
       	echo '<li>' . $key . ' => ' . print_r( $value, true ). '</li>';
       }
       ```
   
 *  Thread Starter [Gregory Karpinsky (@tivnet)](https://wordpress.org/support/users/tivnet/)
 * (@tivnet)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/quick-fix-debug_bar_wp_queryrender-array-to-string-notice/#post-4630556)
 * [@ben](https://wordpress.org/support/users/ben/) Huson:
    I have print_r in my
   second example, when it’s not a scalar, and surrounded by <xmp> (which is a better
   version of
 *     ```
       )
       ```
   
 *  [Ben Huson](https://wordpress.org/support/users/husobj/)
 * (@husobj)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/quick-fix-debug_bar_wp_queryrender-array-to-string-notice/#post-4630559)
 * Sorry, missed that – I was obviously skim reading too fast 🙂
    Use of is_scaler()
   makes sense.

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

The topic ‘[Quick fix] Debug_Bar_WP_Query::render array to string notice’ is closed
to new replies.

 * ![](https://ps.w.org/debug-bar/assets/icon.svg?rev=3050748)
 * [Debug Bar](https://wordpress.org/plugins/debug-bar/)
 * [Support Threads](https://wordpress.org/support/plugin/debug-bar/)
 * [Active Topics](https://wordpress.org/support/plugin/debug-bar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/debug-bar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/debug-bar/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Ben Huson](https://wordpress.org/support/users/husobj/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/quick-fix-debug_bar_wp_queryrender-array-to-string-notice/#post-4630559)
 * Status: not resolved