Import: redirect old attachment pages instead of reporting each as an error

Open
#650 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Domain
backend

Research direction

Start from the importer step that walks the old site's URLs and records the “attachment page … answers ‘not found’” error; that message is the anchor for the code path that must instead group attachment pages and create redirects. Then read how the site report detects the SEO plugin and where Tools › Redirects stores redirects, since the import must reuse that storage and the verdict must count the new redirects as handled. Done when a Polylang import with many media files reports one summarized line with a count and the switch verdict no longer blocks.

Written by the indexing model from the issue text.

Description

area/import type/enhancement when/soon

Importing a five-language Polylang site with 148 media files reported 2,030 errors of one kind: "/some-image-2/, an attachment page on the old site, answers “not found” here. Bring what it showed, or add a redirect for it in Tools › Redirects." With these, the report says "Not ready to switch yet: 2,033 problems need attention", and the only way out offered is a redirect added by hand for each of two thousand addresses.

On most WordPress sites these pages aren't pages readers use: Yoast SEO (and Rank Math) redirect every attachment page to the file itself by default, so search engines never list them.

Expected:

  • the import makes the redirects itself: each attachment page to its file (or to the post it's attached to, as one choice for the whole import), shown as one line in the report with its count, not 2,030 errors;
  • when the site report says the SEO plugin already redirected attachment pages, that is the default choice;
  • the verdict counts them as handled.

🤖 Generated with Claude Code

Dominant language
PHP
Stars
1
Forks
1
Avg merge
1h 40m
Merged PRs (30d)
143

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from temecms/teme

All issues in temecms/teme

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.