Fix SQL error in Posts api when values array empty or not set

Need to pass at least 1 ID to NOT IN part of the SQL query.