Support » Plugin: The Events Calendar » Warning: in_array…post-template.php on line 1039

  • In my calendar page, when a month is empty (no events) I have multiple lines with “Warning: in_array() expects parameter 2 to be array, null given in /home/content/08/10163108/html/wp-includes/post-template.php on line 1039”
    over my menu bar. If I go to a month with some events and I refresh the window, the error messages disapear… WP 3.5 twenty ten tks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Rob La Gatta


    Hey yvanox. Thanks for the note here, and sorry for the inconvenience. Any chance you’ve got a link to your site? I haven’t seen this particular issue and would like to check it out in action.

    A couple suggestions right off the bat, though: make sure you’re on the latest version of Twenty Ten, and – if you can – toggle over to Twenty Eleven or Twenty Twelve to see if the issue persists there. Similarly, can you confirm that you’ve updated the plugin to 2.0.11 and find this issue still persists even then?

    Once I hear back from you, I’ll do my best to advise further. Cheers and thanks for your patience so far.

    I’m getting this error by clicking on a eventcategory where the event is placed:

    Warning: in_array() []: Wrong datatype for second argument in /wp-includes/post-template.php on line 1039

    I’ve found this quote in an other supportforum:
    The PHP warning means that $_current_page->ancestors does not have a datatype of ‘array.’

    What changes had you recently made to the site right before it broke?

    In the other forum… There wasn’t a fix.

    Plugin Author Rob La Gatta


    Hey BosmaMultimedia: did you get this sorted, or are you still having problems here? If the latter, mind sharing a link to the problematic category here? I’m not seeing this on my end and wanted to check it out in action to identify if it’s a bug we need to tackle. Thanks!

    Hi Roblagatta – I’m picking this up on my site too – definitely only on the pages of months sans events. See May on our events calendar.

    Hi majones,

    We have this fixed in our upcoming 3.0 release but unfortunately until then, there is no other fix that we know of.

    – Jonah

    Hi all:

    I posted a fix to this on one of my previous postings. It is a quick fix and does the trick. If you search for my profile name in this support area you may find my posting to this issue. Actually, I found it. Check out this post. Hope it helps.

    [resolved] Calendar Month View Issues (12 posts)

    It was active about 2 weeks ago from the time of this posting.

    Here is the gist of what should help you.

    Here is the work around.

    /wp-includes/post-template.php file is the one you will edit.

    Line 1039 of wp-includes/post-template looks like:

    if ( in_array( $page->ID, $_current_page->ancestors ) )

    Recommended change:

    if ( gettype($_current_page->ancestors) === ‘array’ && in_array( $page->ID, $_current_page->ancestors ) )

    I also recommend you simply rename the original post-template.php file in case this does not work or creates additional problems.

    This will do the trick until the new release comes out.

    Hi smielock,

    Thanks for the work around! Everyone take note though that you are modifying core WordPress files for this fix and if you update WordPress this change will be lost.

    – Jonah

    My server crashed because this error, I made the turnaround and hope the version 3.0 PRO will be released soon.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Warning: in_array…post-template.php on line 1039’ is closed to new replies.