Fix redirection loops after migration, remove trashed, imported posts from the main query, fixes #247