Title: ElasticPress: PHP Parse error: syntax error, unexpected
Last modified: November 6, 2025

---

# ElasticPress: PHP Parse error: syntax error, unexpected

 *  Resolved [suniltemabhare](https://wordpress.org/support/users/suniltemabhare/)
 * (@suniltemabhare)
 * [7 months ago](https://wordpress.org/support/topic/elasticpress-php-parse-error-syntax-error-unexpected/)
 * Hi Support,
   We are using add PHP 7.4, and why is this error showing with the 
   ElasticPress plugin? Please check.Error –  “PHP message: PHP Parse error: syntax
   error, unexpected ‘|’, expecting ‘;’ or ‘{‘ in /var/www/cosmetara.co.uk/wp-content/
   plugins/elasticpress/includes/classes/Feature/WooCommerce/Products.php on line
   1038” while reading response header from upstream
 * this string: `public function get_orderby_meta_mapping( $meta_key ): string|array{`
    -  This topic was modified 7 months ago by [suniltemabhare](https://wordpress.org/support/users/suniltemabhare/).
    -  This topic was modified 7 months ago by [suniltemabhare](https://wordpress.org/support/users/suniltemabhare/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Felasticpress-php-parse-error-syntax-error-unexpected%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Felipe Elia](https://wordpress.org/support/users/felipeelia/)
 * (@felipeelia)
 * [7 months ago](https://wordpress.org/support/topic/elasticpress-php-parse-error-syntax-error-unexpected/#post-18709387)
 * Hey there! Unfortunately, that is an error related to the PHP version in use.
   That happens on PHP 7.4, but does not happen on PHP 8 and later.
 * A new ElasticPress 5.3.1 will be released addressing this problem, but in the
   meantime, I recommend that you upgrade your PHP version, as PHP 7.4 hit its end
   of life back in November 2022 (see [here](https://www.php.net/supported-versions.php)).
 * Also worth mentioning is that [we don’t provide support here](https://wordpress.org/support/topic/read-before-posting-12/).
   For this specific error, we already have a [GitHub issue](https://github.com/10up/ElasticPress/issues/4231),
   but if you see anything else, please open a GitHub issue instead. Thanks!

Viewing 1 replies (of 1 total)

The topic ‘ElasticPress: PHP Parse error: syntax error, unexpected’ is closed to
new replies.

 * ![](https://ps.w.org/elasticpress/assets/icon-256x256.jpg?rev=2458479)
 * [ElasticPress](https://wordpress.org/plugins/elasticpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/elasticpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/elasticpress/)
 * [Active Topics](https://wordpress.org/support/plugin/elasticpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/elasticpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/elasticpress/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Felipe Elia](https://wordpress.org/support/users/felipeelia/)
 * Last activity: [7 months ago](https://wordpress.org/support/topic/elasticpress-php-parse-error-syntax-error-unexpected/#post-18709387)
 * Status: resolved