Support » Plugin: Google Forms » Admin : Error on line 2001

  • Resolved Kheltdire


    I saw that you didn’t check your plugin with the WordPress 3.9. I did and i got this in the back office :

    Warning: array_map() [function.array-map]: Argument #2 should be an array in [ABS_PATH]/wp-includes/post.php on line 2001
    Warning: array_map() [function.array-map]: Argument #2 should be an array in [ABS_PATH]/wp-includes/post.php on line 2001

    No problem on the front, but it makes some back office’s operation kinda boring (since an error is sent, there is some content before the redirections, so the classical “headers already sent” appears after an update).

    I hope you’ll have some time to check this issue 🙂
    Best regards,

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Mike Walsh


    This error doesn’t happen on my web site nor in my development environment. I’ll keep looking but can you try temporarily disabling all plugins except Google Forms and let me know if the problem persists?

    Thanks for your quick reply 🙂

    I tried your suggestion, disabling every plugins, but the problem is still here.

    Could it be caused by the server configuration (showing not only errors, but warnings too) ? I’ll take a look and let you know if i found something

    Plugin Author Mike Walsh


    Unlikely it is a server config as in my development environment I have everything enabled so I even see minor PHP notices.

    It could be a theme issue. If you temporarily switch to one of the default themes (I like TwentyTen) does it still happen? What theme are you using?

    What version of PHP does your server run?


    I’m using a child theme for Twenty Fourteen, and even if I enable only the main theme, I still got this issue :/

    The PHP version of my server is 5.3

    Plugin Author Mike Walsh


    I’ve spent some more timing looking at this tonight and can’t figure out what the problem is. I have activated the TwentryFourteen theme and am running PHP 5.3.13 on my development site.

    My development site runs on top of IIS running on Windows. I will try it on a Linux server later tonight if I have a chance. The chunk of code which has an issue is this:

    // Fields which contain arrays of ints.
    	$array_int_fields = array( 'ancestors' );
    	if ( in_array($field, $array_int_fields) ) {
    		$value = array_map( 'absint', $value);
    		return $value;

    I am not sure what the ‘ancestors’ refers to but array_map() is expecting $value to be an array of values and it isn’t.

    I’ll re-install the WordPress on another server, more trustworthy than this one. This way i’ll be able to tell if it’s due to a lack of permissions/plugins/? of the server.

    In the same time, i’ll check the chunk of code, and see i can “force” the type of the value 🙂

    I got that too, although the plugin seems to be functioning.

    It’s line 84 in wpgform-post-type.php that’s causing it.

    if ($content !== get_the_content())
          wp_update_post(array('ID' => get_the_ID(), $content)) ;

    Changin it to

    if ($content !== get_the_content())
         wp_update_post(array('ID' => get_the_ID(), 'post_content' => $content));

    Seems to fix the issue (although I haven’t read most of the code so I’m not 100% sure what’s going on there :)).

    Plugin Author Mike Walsh


    Thanks for chasing this down – now that you point it out I see the error in the code. Odd that it doesn’t manifest itself in development environment. It doesn’t happen on my own server either. Regardless, leaving out the parameter name in the array passed to wp_update_post() is a mistake.

    What this code does is make sure the post content of any Google Forms (which are custom posts) contains only the shortcode syntax for the form. This ensures the form is rendered properly when using the form’s permalink to render the form instead of placing the shortcode on a post or page.

    Prior to version v0.64 I would try and detect this situation and inject the shortcode into the content stream before the shortcode processor ran however it was problematic, particularly if a plugin or theme made multiple calls to do_shortcode() (which I ran into quite a few times).

    This bit of hygiene code simply makes sure the post content is set to what the plugin expects it to be. It also makes sure than any forms defined prior to v0.64 will be updated correctly.

    That’s works perfectly !

    Thanks a lot <3

    Plugin Author Mike Walsh


    I just released v0.68 to fix this problem.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Admin : Error on line 2001’ is closed to new replies.