What is wrong with functions.php? Fills error log with same error


After a third-party developer was used to reconnect our calendar with the Google Calendar API 3, we found that our …/wp_admin/error_log infinitely wrote:

[14-Apr-2015 11:46:59 America/New_York] PHP Warning:  in_array() expects parameter 2 to be array, null given in /home/USERFOLDER/public_html/wp-content/themes/THEMENAME/functions.php on line 2410

We have disabled writing to the error log, as it literally repeats that error until the HDD fills. In the functions.php file, line 2410 referenced in the error above is blank; the code around it is as follows:

function THEMENAME_sort_terms_hierarchicaly($cats, Array &$into, $parentId = 0, $level = 0){

    foreach ($cats as $i => $cat) {

        if ($cat->parent == $parentId) {

            $into[$cat->term_id] = $cat;

            $into[$cat->term_id]->level = $level;



 ///THIS IS LINE 2410

    foreach ($into as $topCat) {

        $topCat->children = array();

        THEMENAME_sort_terms_hierarchicaly($cats, $topCat->children, $topCat->term_id, $level);


    return $into;


Howdy_McGee points out below that in_array() is not within the code snippet, I am reviewing the 6 in_array(…) instances from the functions.php page but have not yet found the issue.

These first two are likely more precedent as they fall within the //Admin Section of the functions.php code.

// Adding is login page function

function is_login_page() {

    return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'));


Other in_array(..) from admin section:

// Remove unwanted items from admin menu

function THEMENAME_remove_admin_menu_items() {

    $remove_menu_items = array(__('Dashboard'),__('Posts'),__('Media'),__('Pages'),__('Comments'),__('Appearance'),__('Plugins'),__('Users'),__('Tools'),__('Settings'),);

    global $menu;

    end ($menu);

    while (prev($menu)){

        $item = explode(' ',$menu[key($menu)][0]);

        if(in_array($item[0] != NULL?$item[0]:"" , $remove_menu_items)){




Is there something here that I have missed that would reference line 2410 and cause this error? Do I need to rewrite each of my…


with… ?

is_array($y) && in_array(x,$y)
, , beta208 8 years 2015-04-15T08:26:34-05:00 0 Answers 66 views 0

Leave an answer