I\"m getting an unexpected T_FUNCTION php error after uploading my Wordpress files to a server running php version 5.2.17.
The theme works fine on localhost (with MA
You cannot have anonymous functions in PHP less than 5.3
Rework your code so that it does not involve anonymous functions and it should work on your older server.
anonymous functions available from PHP 5.3.0
add_action()
's second parameter is of type callback.
Pre 5.3, this is usually a string representing a function:
add_action('init', 'myFunction');
function myFunction() { echo 'init'; }
There are alternatives such as create_function and other syntaxes to use when dealing with objects.
5.3 onward, anonymous functions are allowed:
add_action('init', function() { echo 'init'; });