diff --git a/mu-plugins/osi-api/osi-api.php b/mu-plugins/osi-api/osi-api.php index 7ee0edd..08d2241 100644 --- a/mu-plugins/osi-api/osi-api.php +++ b/mu-plugins/osi-api/osi-api.php @@ -136,13 +136,10 @@ public function get_licenses( WP_REST_Request $data ) { $args['post_title_like'] = sanitize_text_field( $searched_slug ); // Use the post name (slug) to filter by ID } elseif ( ! empty( $spdx ) ) { - // Cast the term to a regex pattern - $regex = $this->cast_wildcard_to_regex( $spdx ); - // If we have no wildcards, look for a direct match $args['meta_query'][] = array( 'key' => 'spdx_identifier_display_text', - 'value' => $regex, + 'value' => str_contains( $spdx, '*' ) ? $this->cast_wildcard_to_regex( $spdx ) : sanitize_text_field( $spdx ), 'compare' => str_contains( $spdx, '*' ) ? 'REGEXP' : '==', ); } elseif ( ! empty( $keyword ) ) {