Skip to content

Commit

Permalink
Merge pull request #364 from lloc/297-directly-fill-in-the-post-id-or…
Browse files Browse the repository at this point in the history
…-search-to-find-the-corresponding-translated-article

Use 'include' instead of 's' in case that the input is numeric
  • Loading branch information
lloc authored Aug 16, 2024
2 parents c0d4a6c + 16d6927 commit 5b24e90
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/MslsMetaBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ public static function suggest() {
}

if ( MslsRequest::has_var( MslsFields::FIELD_S, INPUT_POST ) ) {
$args['s'] = sanitize_text_field(
$value_s = sanitize_text_field(
MslsRequest::get_var( MslsFields::FIELD_S, INPUT_POST )
);

/**
* If the value is numeric, we assume it is a post ID
*/
is_numeric( $value_s ) ? $args['include'] = array( $value_s ) : $args['s'] = $value_s;
}

$json = self::get_suggested_fields( $json, $args );
Expand Down

0 comments on commit 5b24e90

Please sign in to comment.