Title: Warning: array_map(): Argument #2 should be an array in
Last modified: September 26, 2017

---

# Warning: array_map(): Argument #2 should be an array in

 *  Resolved [asmundkr](https://wordpress.org/support/users/asmundkr/)
 * (@asmundkr)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/warning-array_map-argument-2-should-be-an-array-in/)
 * I get two warnings when insterting a custom post in a normal post. The custom
   post type was created using the “Toolset Types” plugin ([https://wordpress.org/plugins/types/](https://wordpress.org/plugins/types/)).
 * The warnings are as follows:
    Warning: array_map(): Argument #2 should be an 
   array in /app/public/wp-content/plugins/insert-pages/insert-pages.php on line
   315
 * Warning: implode(): Invalid arguments passed in /app/public/wp-content/plugins/
   insert-pages/insert-pages.php on line 316
 * I have not done any thorough testing but I assume get_post_custom_values( $key)
   returns a string (not an array) when the only custom field is a single text field.
 * Possible Fix – insert-pages.php on line 315 (Check if array):
 *     ```
       $value = get_post_custom_values( $key );
       if ( is_array( $value ) ) {
       	$values = array_map( 'trim', $value );
       	$value = implode( $values, ', ' );
       }
       ```
   
    -  This topic was modified 8 years, 8 months ago by [asmundkr](https://wordpress.org/support/users/asmundkr/).

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

 *  Plugin Author [Paul Ryan](https://wordpress.org/support/users/figureone/)
 * (@figureone)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/warning-array_map-argument-2-should-be-an-array-in/#post-9564289)
 * Thanks for catching that! I’ve integrated your code, it looks perfect.
    [https://github.com/uhm-coe/insert-pages/commit/e45d96fd3b522fb129f898cbc0aad41fafd34dda](https://github.com/uhm-coe/insert-pages/commit/e45d96fd3b522fb129f898cbc0aad41fafd34dda)
 * This will be included in the next release.
 *  Plugin Author [Paul Ryan](https://wordpress.org/support/users/figureone/)
 * (@figureone)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/warning-array_map-argument-2-should-be-an-array-in/#post-9564442)
 * Version 3.2.5 released with this fix. Let us know if you run into any problems!

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

The topic ‘Warning: array_map(): Argument #2 should be an array in’ is closed to
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/insert-pages.svg)
 * [Insert Pages](https://wordpress.org/plugins/insert-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-pages/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Paul Ryan](https://wordpress.org/support/users/figureone/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/warning-array_map-argument-2-should-be-an-array-in/#post-9564442)
 * Status: resolved