• Resolved asmundkr

    (@asmundkr)


    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://ww.wp.xz.cn/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.
Viewing 2 replies - 1 through 2 (of 2 total)
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.