WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#41972 new enhancement

Add Import/Export functionality to the Customizer

Reported by: philclothier Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.2
Component: Customize Keywords:
Focuses: ui Cc:

Description

As a theme author, a big part of our documentation and guidance is instructing people how to replicate different theme previews. Fr complex Customizer settings, it would be great to be able to provide a user with a file which could be uploaded to the site. Much like uploading an xml file to import the post/page content.

I'm aware of plugins such as https://wordpress.org/plugins/customizer-export-import. However I think it would be a great enhancement to add import/export functionality to core, removing the reliance on a plugin and the extra burden this adds for beginner level users.

This could also help alleviate issues raised in #27177.

The import/export options could be a further development of the UI mentioned in #39896.

Change History (1)

#1 @westonruter
4 weeks ago

cf. my comment on #39896:

It is trivial to implement an export feature because it's simply a matter of exporting the contents of the customize_changeset post. Well, and any posts that may be referenced in that changeset.

The hard thing is importing a changeset. Settings for widgets and nav menus all make reference to auto-incremented IDs in their settings, and so importing a changeset would run the real risk of conflicting with existing changes on a given site. Importing a changeset in a way that does not conflict with existing content is what the starter content feature was designed to solve: #38114.

In order to export and import a changeset, it would essentially need to be able to “understand“ the structure of the IDs (e.g. nav_menu_item[123] and the structure of the values, like when page_on_front is set to 4, that the 123 in the former and the 4 in the latter are both references to post IDs. It's the same problem you get when trying to migrate parts of a database from one site to another existing database. This is a problem that VersionPress has been focused on heavily as well as Mergebot. There may be a way to leverage schema work done by these projects as a way to inform a changeset import/export tool. But it would be out of scope for this ticket.

Note: See TracTickets for help on using tickets.