Skip to content

Font Files do not export/import properly via XML/WXR exporter. #59109

@peterwilsoncc

Description

@peterwilsoncc

Description

When exporting and importing content via the WordPress Importer font faces are not imported to the new domain correctly.

This can result in broken designs as the templates imported from the original site are referring to font files on the old site.

When imported with the Download and import file attachments option checked the font files should be:

  • uploaded to the new site
  • URLs updated to point to their new location

For clarity, this is referring to the XML/WXR exporter available via the WP Dashboard's Tools > Export menu.

Step-by-step reproduction instructions

  1. Create multiple sites running WordPress trunk (one for export, one for import)
  2. On the exporter site:
    1. Edit the 2024 home page
    2. Download Open Sans from Google Fonts (ie, visit the site and download them to your computer)
    3. Open the style editor > typography > Manage Fonts > Upload
    4. Upload the Open Sans files (standard will do, don't worry about condensed, etc)
    5. Close the model once upload is complete
    6. Go through each of the element types and change the font to Open Sans
    7. Use the Yoast Faker CLI tool to create some fake content (this will include attachments)
    8. Visit Tools > Export and download all content
    9. Keep this site running for the next step
  3. On the importer site:
    1. Install and activate the WordPress Importer plugin
    2. Note: For localhosts you may need to change this line to use wp_remote_get()
    3. Visit Tools > Import > WordPress > Run Importer
    4. Check the box to import attachments at the bottom of the screen
    5. Shut down the exporter site
    6. Visit the importer site's front end
    7. Observe the fonts use system defaults
    8. In the browser network tools observe the fonts are trying to make request to the exporter site
    9. Open the style editor > typography > Manage Fonts
    10. Observe the Open Sans fonts are marked as installed locally via uploads
    11. When looking at the content created, you'll notice the media file URLs have been updated in the content to refer to the importer site's URL

Screenshots, screen recording, code snippet

Screenshot from localhost (importer site), notice font face URLs refer to wp-dev.local (exporter site)

Screen Shot 2024-02-16 at 1 05 03 pm

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Font Library[Priority] HighUsed to indicate top priority items that need quick attention[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions