Skip to content

Commit 5b24e90

Browse files
authored
Merge pull request #364 from lloc/297-directly-fill-in-the-post-id-or-search-to-find-the-corresponding-translated-article
Use 'include' instead of 's' in case that the input is numeric
2 parents c0d4a6c + 16d6927 commit 5b24e90

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

includes/MslsMetaBox.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ public static function suggest() {
3535
}
3636

3737
if ( MslsRequest::has_var( MslsFields::FIELD_S, INPUT_POST ) ) {
38-
$args['s'] = sanitize_text_field(
38+
$value_s = sanitize_text_field(
3939
MslsRequest::get_var( MslsFields::FIELD_S, INPUT_POST )
4040
);
41+
42+
/**
43+
* If the value is numeric, we assume it is a post ID
44+
*/
45+
is_numeric( $value_s ) ? $args['include'] = array( $value_s ) : $args['s'] = $value_s;
4146
}
4247

4348
$json = self::get_suggested_fields( $json, $args );

0 commit comments

Comments
 (0)