1
votes

I am using Rest Routes plugin for building custom endpoints for WP Rest API. This plugin is tested for compatibility for upto WordPress versioin 4.5.9. I'm using WordPress version 4.6.6 on my localhost and the plugin works fine. I'm able to create custom endpoints. But when I install this plugin in the live server, where I'm using the same version of wordpress, 4.6.6, the plugin doesn't get activated, showing me an error:

Parse error: syntax error, unexpected '[' in /nfs/c07/h03/mnt/109306/domains/lrp.magikbox.biz/html/wp-content/plugins/rest-routes/inc/filters/wprr-filter-post_type.php on line 92

1

1 Answers

0
votes

The error is generating from $post_type_arr = []; raised by [ of post type filter. It seems the Array Initialization Construct: [] is the cause of the error. I tried recreating your error with my production server running PHP 7 but Rest Routes activated successfully. I have checked your website: http://lrp.magikbox.biz/ it runs on PHP 5.3.29, sadly short Array Initialization Construct [] only works for PHP 5.4+ - see here.

Check your development server (your localhost) it is certainly running PHP 5.4+. As a solution either consider changing your host to one that supports PHP 5.4 and above or use WP Rollback plugin and roll back the plugin to its early 2014 version when PHP 5.3.29 was released.