Skip to content

Commit

Permalink
Use 'include' instead of 's' in case that the input is numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
lloc committed Aug 16, 2024
1 parent c0d4a6c commit 16d6927
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 16d6927

Please sign in to comment.