Title: Undefined array key &#8220;compare&#8221; in lib/search.php
Last modified: May 23, 2026

---

# Undefined array key “compare” in lib/search.php

 *  Resolved [ArtZ91](https://wordpress.org/support/users/artz91/)
 * (@artz91)
 * [2 weeks, 1 day ago](https://wordpress.org/support/topic/undefined-array-key-compare-in-lib-search-php/)
 * E_WARNING – Undefined array key “compare” in /wp-content/plugins/relevanssi/lib/
   search.php on line 1243
 * Relevanssi 4.27.0, PHP 8.3.6

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [2 weeks, 1 day ago](https://wordpress.org/support/topic/undefined-array-key-compare-in-lib-search-php/#post-18916908)
 * Yeah, we’ll fix that in the next version. It’s annoying to get the warning, but
   it’s nothing dangerous. Defining the `compare` in the meta query you’re using
   will make the warning go away.
 *  Thread Starter [ArtZ91](https://wordpress.org/support/users/artz91/)
 * (@artz91)
 * [2 weeks ago](https://wordpress.org/support/topic/undefined-array-key-compare-in-lib-search-php/#post-18917530)
 * I think the reason of warning might be `relation` key in meta_query array: 
   [`'
   relation' => 'AND', […], […], …]`
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [2 weeks ago](https://wordpress.org/support/topic/undefined-array-key-compare-in-lib-search-php/#post-18917535)
 * No, the warning clearly says it’s because the `compare` parameter is not set (
   it’s an optional parameter, and Relevanssi should treat it like that but doesn’t).
   That’s why setting it will make the warning go away. The `relation` parameter
   is not related.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fundefined-array-key-compare-in-lib-search-php%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * Last activity: [2 weeks ago](https://wordpress.org/support/topic/undefined-array-key-compare-in-lib-search-php/#post-18917535)
 * Status: resolved