Hi I’m seeing the same message when I try to activate the plugin: unexpected ‘[‘ in /.…../wp-content/plugins/wp-infinite-scrolling/wp-infinite-scrolling.php…
Hi I’m seeing the same message when I try to activate the plugin: unexpected ‘[‘ in /.…../wp-content/plugins/wp-infinite-scrolling/wp-infinite-scrolling.php…
Hi,
I’m not sure if any of you are still having this issue, but I have a couple of solutions for you to try.
There is a function in this plugin that relies on array dereferencing, This is a function that was introduced in PHP 5.4. Your best way to fix this is to contact your hosting provider and ask them to upgrade your servers version of PHP to at least 5.4.
If you are unable to do that, or your hosting provider will not let you, then unfortunately you will need to modify the core plugin files, which normally isn’t recommended.
In the plugin there will be a file called ‘wp-infinite-scrolling.php’. On line 23 there will be the below function:
function wpifs_option( $key ) {
return get_option( "wpifs_{$key}", wpifs_defaults()[$key] );
}
This is where the issue is, the way the get_option array is written is perfect and will work for PHP versions of 5.4 and higher. However if you want this to work with older versions of PHP (and newer ones for that matter) then you will need to change it to the below:
function wpifs_option( $key ) {
return get_option( "wpifs_{$key}", wpifs_defaults($key) );
}
Hope that helps!