Loaded starter content images from media library - #4537
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #4532, where Neve's Default starter-content hero/section images were embedded in published pages as theme-directory URLs ({{theme_uri}}assets/img/starter-content/folio-*.jpeg) and were never sideloaded into the Media Library — so they 404'd after a theme update that renamed/removed the bundled assets. The change sideloads those images into the Media Library and rewrites the published pages to point at the resulting attachment URLs, both for new publishes and via a one-time migration for already-published sites.
Changes:
- Adds the five
folio-*content images to the core starter-contentattachmentsarray so WordPress imports them into the Media Library. - On publish (
after_publish→sync_content_images), imports each content image (dedup via_customize_draft_post_name) and replaces the legacy theme-URL references in home/about/services/work pages with the attachment URLs. - Registers a one-time
initmigration (migrate_legacy_content_images, guarded by theneve_starter_content_migratedoption) that repoints already-published starter pages.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
inc/compatibility/starter_content.php |
Adds content-image attachment definitions, sideload/dedup helper, per-page URL migration, publish-time sync, and a static one-time legacy migration; merges content images into the attachments array. |
globals/migrations.php |
Hooks Starter_Content::migrate_legacy_content_images onto init to run the one-time migration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Upload starter content images and migrate the legacy starter content images to the media library, if they haven't been already.
Check before Pull Request is ready:
Closes #4532