Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions mu-plugins/osi-api/osi-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand Down