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
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'; });