Skip to content

Commit 16d6927

Browse files
committed
Use 'include' instead of 's' in case that the input is numeric
1 parent c0d4a6c commit 16d6927

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)