Fixes 404/redirect loop error after migration, removes trashed posts from query