Support » Fixing WordPress » Parse error: syntax error, unexpected $end, expecting T_STRING or T_VARIABLE

  • I am facing this issue
    Parse error: syntax error, unexpected $end, expecting T_STRING or T_VARIABLE or ‘{‘ or ‘$’ in /home1/madworxx/public_html/wp-includes/nav-menu.php on line 720

    see the code below
    function wp_setup_nav_menu_item( $menu_item )
    {
    if ( isset( $menu_item->post_type ) )
    {
    if ( ‘nav_menu_item’ == $menu_item->post_type )
    {
    $menu_item->db_id = (int) $menu_item->ID;
    $menu_item->menu_item_parent = empty( $menu_item->menu_item_parent ) ? get_post_meta( $menu_item->ID, ‘_menu_item_menu_item_parent’, true ) : $menu_item->menu_item_parent;
    $menu_item->object_id = empty( $menu_item->object_id ) ? get_post_meta( $menu_item->ID, ‘_menu_item_object_id’, true ) : $menu_item->

    last line is no. 720
    even when I complete parenthesis wordpress dashboard works but not the website, what can be the error?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey Suyash87,

    The problem is likely the -> after $menu_item on the last line. When you use the -> operator, PHP is expecting you to reference a property name using a string or variable. If there’s nothing but whitespace following the -> operator, that may be the reason for your error.

    It’s worth noting at this point that you shouldn’t be modifying the core WordPress files directly, which includes everything in the wp-admin/ and wp-includes/ directories. Instead, you should take advantage of the Plugin API to change default WordPress functionality.

    Hello Jeremy

    I have removed spaces already, please check http://jdadultfamilycare.com/

    its showing error

    Hey Suyash87,

    If you have modified that file at all, it may be best to just delete all of the WordPress files and download a fresh copy. That would be the quickest way to ensure you have a clean, unmodified copy of all of the WordPress files, and you won’t have to worry about any syntax errors from those files.

    can’t do that, website has data and was working few days back

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    website has data and was working few days back…

    Your data and content is in the database, not in static WordPress core files.

    Don’t replace wp-content (where your theme and uploads are) or wp-config.php, but replace wp-admin and wp-includes with good copies.

    no other way?

    Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Parse error: syntax error, unexpected $end, expecting T_STRING or T_VARIABLE’ is closed to new replies.