Good Day Everyone,

I want to test my Plugin online on my real website but I don't know why, the following line would give an error, when on my local installation everything works perfectly. (I tried to deactivate and reactivate on my local install and I don't get the error).

Both are using the latest version of WordPress (4.2.2)

add_action('wp_enqueue_scripts', 'plugin_jquery');
function plugin_jquery()
    if (!is_admin())
        wp_enqueue_script('plugin-jquery', plugins_url('js/plugin_regpage.js', __FILE__), ['jquery'], true);

         plugins_url('css/plugin_regpage.css', __FILE__)

I get:

Parse error: syntax error, unexpected '[' in html/wp-content/plugins/plugin/plugin.php on line 49

Why would a bracket make a problem online and not locally?

  • 1
    The new short array syntax ([]) is only avaible from PHP 5.4. Jun 4, 2015 at 10:28
  • 2
    Online version is less than PHP 5.4 while offline is bigger than PHP5.4 ;-) Jun 4, 2015 at 10:30
  • Hmmmmmmmm... Let me have a look at that ;-) You might have put your finger on it... How would I fix it then :-/
    – pSyToR
    Jun 4, 2015 at 10:34
  • 1
    O yes, array( 'jquery' ) is correct Jun 4, 2015 at 10:49
  • 1
    Thanks at least this way I will be able to test it properly for the time being... I will also contact them as 5.3 is EOL since 9 months already...
    – pSyToR
    Jun 4, 2015 at 10:58

1 Answer 1


This is an issue with your PHP versions on your local and live install.

The new short array syntax ([]) was implemented in PHP 5.4. This tells you that your PHP version on your local install is at least PHP 5.4 and your live install has a version older than that. The new short array syntax will lead to a PHP error in older versions as it is invalid PHP in the older versions.


As PHP 5.3 was EOL'ed almost a year ago, it is a very good and security wise idea to ask your host to upgrade their PHP version to atleast PHP 5.4. Alternatively, you can change your new short array syntax back to the old array syntax.


then becomes

array( 'jquery' )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.