I'm working on a custom search page and I usually use wpdb->prepare when crafting custom queries. But this time I went with get_posts to create the below query. But I'm wondering if I have to worry about SQL Injection with it. Should I? Or does get_posts() have that security built in?
If not, how do I clean the incoming variables?
$SEARCH_QUERY = @$_GET['s2']; $args2 = array( 'orderby' => 'date', 'order' => 'DESC', 's' => $SEARCH_QUERY ); $arrSearchResults = get_posts($args2); echo "<pre>"; print_r($arrSearchResults); echo "</pre>";