PHP parsing error: unexpected 'if' (T_IF)

advertisements

This question already has an answer here:

  • PHP Parse/Syntax Errors; and How to solve them? 11 answers

I just had this error pop up on my site a couple days ago:

Parse error: syntax error, unexpected 'if' (T_IF) in /home1/reapusa/public_html/wp-content/plugins/layerslider/wp/actions.php on line 122

I checked out the code that the error is supposedly on, but I'm not seeing any weird characters, missing semicolons, or anything else that might cause an error. I've checked out other threads to see if a solution has already been found, but to no avail.

Am I missing something?

Here's the section of code that's causing the error:

if(isset(
  if(check_admin_referer('hide-revalidation-notice')) {
    update_option('ls-show-revalidation-notice', 0);
    header('Location: admin.php?page=layerslider');
    die();
  }
}


You cannot have an if statement inside of a condition. I'm not sure if this will work as I'm not amazing with PHP, but try this:

if(isset(check_admin_referer('hide-revalidation-notice')) {
        update_option('ls-show-revalidation-notice', 0);
        header('Location: admin.php?page=layerslider');
        die();
}