From 25a99e6b1986f9fda70672539fb24984c06eb7e0 Mon Sep 17 00:00:00 2001 From: Patrick Coombe Date: Wed, 3 Jun 2026 13:34:42 -0400 Subject: [PATCH] Docs: Clarify that meta_query REGEXP values are raw MySQL patterns. Document in the WP_Meta_Query DocBlock that when $compare is 'REGEXP', 'NOT REGEXP', or 'RLIKE', the $value is used as a raw MySQL regular expression and must not be wrapped in delimiters such as '/'. Props letraceursnork. Fixes #58180. --- src/wp-includes/class-wp-meta-query.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-meta-query.php b/src/wp-includes/class-wp-meta-query.php index 67e2d3d27ee0b..1ad85602814cc 100644 --- a/src/wp-includes/class-wp-meta-query.php +++ b/src/wp-includes/class-wp-meta-query.php @@ -130,7 +130,9 @@ class WP_Meta_Query { * @type string $type_key MySQL data type that the meta_key column will be CAST to for * comparisons. Accepts 'BINARY' for case-sensitive regular expression * comparisons. Default is ''. - * @type string|string[] $value Meta value or values to filter by. + * @type string|string[] $value Meta value or values to filter by. When $compare is set to + * 'REGEXP', 'NOT REGEXP', or 'RLIKE', the value is used as a raw MySQL regular + * expression and should not be wrapped in delimiters such as '/'. * @type string $compare MySQL operator used for comparing the $value. Accepts: * - '=' * - '!='