Resolved Error “PHP Fatal error: Cannot redeclare”

kumkumsharma

Administrator
Staff member
If you are getting error “PHP Fatal error: Cannot redeclare” function the it means you are declaring same function multiple times in your code.

There can ne three reasons if you are getting error:
  • Using same function in 2 files.
  • If you are define function in two places within same file.
  • Two times files are included which has same function.
You always have to use include_once to include a file in place of include in functions.php file. This will help to overcome the issue which is explained in 3rd point.
 
Top