There is a website on wordpress , which needs transfer to another hosting from a domain in the Latin alphabet to a domain in Cyrillic. On the 2nd hosting, a domain with a Cyrillic domain name has been created and linked, and a corresponding folder has been created (in Latin). Transferred the site, DB, set up the conversion of the domain name using the service . As a result: it starts up in the admin panel, displays the standard theme, but in the created one it causes a 500 error - in the logs:

[24-Nov-2016 07:37:39] PHP Parse error: syntax error, unexpected '[', expecting ')' in /home/name/wp-content/themes/themes-name/front-page.php on line 116 [24-Nov-2016 07:38:57] PHP Parse error: syntax error, unexpected '[', expecting ')' in / home / name / wp-content / themes / themes-themes / front-page. php on line 116

in this place - 116 line <?php $section_gates = new WP_Query([ :

 <?php $section_gates = new WP_Query([ 'post_type' => 'section_gates', 'name' => 'sektsionnye-vorota', 'post_status' => 'publish', 'posts_per_page'=> -1, 'order' => 'ASC' ]); while($section_gates->have_posts()): $section_gates->the_post(); 

On the Latin mirror, everything works without problems and errors at the same time. What is the reason, how to find and fix the error?

  • @Geyan read carefully .htaccess удалил - Vasya
  • This error is due to the fact that the browser cache is stuffed with junk, I asked for a link to the site and if it turns out that it works for me and you do not have ... - user33274
  • @Geyan browser cache is nothing to do with - in different parts of the city, on different devices all the same. I managed to fix something - I changed the description of what I came to - Vasya
  • Speech about wordpress? - user33274
  • 2
    PHP version is what? Php.ini include short_open_tag? - Ninazu

1 answer 1

On the Latin mirror, you have the PHP 5.4+ version and the "problem" version below. The problem arises from the fact that only starting with version 5.4, array literals were supported. That is, you can now write like this:

 $arr = [1, 2, 3, 4]; 

On earlier versions you need to write like this:

 $arr = array(1, 2, 3, 4); 

You can solve the problem like this (in order of complexity):

  1. Change the version of PHP (many hosters allow it);
  2. Change hoster;
  3. Change all references to the literal notation of an array to array(...) .
  • I advise you to try point 1, then point number 2, but never use 3 :) - ilyaplot
  • @ilyaplot Miscellaneous situations - tutankhamun
  • Pay the hoster money for a product that was outdated several years ago and not be able to update the engine? Bad situation. - ilyaplot
  • 2
    @ilyaplot Situations are bad :) - tutankhamun