I am working on a WordPress plugin and need to sanitize the POST data within this function. Would sanitize_text_field() be the best way to go about it? Also what is the proper way to add it to the code below?
header( 'Content-Type: application/json' );
global $wpdb;
$session_id = $_POST['session_id'];
$procedure_name = $wpdb->prefix . 'get_geojson_route';
$gps_locations = $wpdb->get_results($wpdb->prepare(
"CALL {$procedure_name}(%s);",
array(
$session_id
)
));