Support » Fixing WordPress » Parse error: syntax error, unexpected ‘function’ (T_FUNCTION)

  • Hi, right now I have this error on my website:

    Parse error: syntax error, unexpected ‘function’ (T_FUNCTION), expecting while (T_WHILE) in /home2/hatha/public_html/ on line 623

    It happened after I made a backup on my website redirected the domain. The php version my hosting provider is running is 5.6

    This are the lines of code:

    function has_action($tag, $function_to_check = false) {
    return has_filter($tag, $function_to_check);

    I appreciate any help!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello!

    Your outdated PHP version can be one cause.

    Your theme or a plugin is trying to use more advanced PHP features which you don’t have because you’re on PHP 5.6.

    Updating your PHP version might fix this and other future issues.

    But someone with web development experience might have another fix for you.

    That’s the only one that I can think about.

    Moderator Steven Stern


    Support Team / Sword in the Darkness

    This may be a plugin or theme conflict. Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.

    If you can install plugins, install “Health Check”: On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you, while you’re still logged in, without affecting normal visitors to your site. You can then use its admin bar menu to turn on/off plugins and themes one at a time.


    Hi! Thanks for your replies, I will try it and be back to let you know how it worked out.

    Unfortunately, deactivating the plugins through FTP using the wpbeginner guide didn’t allow me to log in to my WordPress dashboard, I still see the exact same error on the screen…

    I haven’ tried the PHP upgrade. Should I ask my host for this? Or it’s something I can do on my own?

    I really appreciate your help.🙏🏽

    Moderator Steven Stern


    Support Team / Sword in the Darkness

    Also reset your theme — just rename the active theme’s folder to something to forxe WP to use a default theme.

    The safest way is to talk to your host, not to do it alone. They might not allow you to upgrade the PHP version or they might not even support a higher version.

    Reset your theme first, though, as pointed out above. See if that works.

    Perform a full website backup before asking your host about the PHP upgrade.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Parse error: syntax error, unexpected ‘function’ (T_FUNCTION)’ is closed to new replies.