How to securely provide a $_POST var in WP_Query with PHP 7?

Maybe you could try this, to sanitize the whole $_POST array

$_POST  = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);

Or to sanitize just a field, you could use the native WP function

$sanitized = sanitize_text_field ( $_POST['key'] );