WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] PHP server upgrade and webpage doesn't work - functions.php error (2 posts)

  1. bob3s
    Member
    Posted 1 year ago #

    My host upgrade PHP version from 5.3 to the PHP 5.3.23 adn now I get this error:
    Fatal error: Invalid opcode 153/1/8. in /public_html/wp-content/themes/my_theme/functions.php on line 520

    Function.php file has this:
    add_filter('wp_nav_menu_objects', function ($items) {
    $hasSub = function ($menu_item_id, &$items) {
    foreach ($items as $item) {
    if ($item->menu_item_parent && $ite->menu_item_parent==$menu_item_id) {
    return true;
    }
    }
    return false;
    };

    foreach ($items as &$item) {
    if ($hasSub($item->ID, &$items)) {
    $item->classes[] = 'dropdown'; // all elements of field "classes" of a menu item get join together and render to class attribute of

  2. element in HTML
    $item->attr_title=$item->title;
    $item->attr_class ='dropdown-toggle';
    $item->attr_data_toggle='dropdown';
    //break;
    }
    }
    return $items;
    });

    I don't know what to do and what is wrong, because with version 5.3 everything was working. I use tle last WP version.

  • bob3s
    Member
    Posted 1 year ago #

    I resolved the problem. My host use eaccelerator which doesn't support anonymous function. So I did:

    function MY_NAME($items) {
    code of this function
    }

    add_filter('wp_nav_menu_objects', 'MY_NAME');

    Everything is working now!

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags