Theme export in WordPress 6.0

The “Export” feature in the Site Editor has been improved so that now you can export your whole theme, including all the edits you have made to your templates and styles. Previously the export function only gave you access to your template files. This change makes it possible to build a blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. theme using the site editor and easily share the zip file with anyone.

The Export process

The export process copies all files from the current theme into a zip file. Then it extracts the template changes that are stored in the database to files and adds them to the zip file. If these templates have the same names as those in the theme, they will be overwritten, so that the database version takes precedence. The same process happens for the theme.json file. There are three directories that are excluded from the export: .git, node_modules and vendor.

Unexpected changes

The export process may make a few unexpected changes to your templates and theme.jsonJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. files.

  1. The output of template files from the database will be sanitized for security reasons. You’re most likely to notice this with any CSSCSS Cascading Style Sheets. variables in your template files: e.g. --wp--custom--spacing--outer would become \u002d\u002dwp\u002d\u002dcustom\u002d\u002dspacing\u002d\u002douter.
  2. The properties in theme.json are now sorted alphabetically, so the first time you export you might notice some of the objects in your theme.json move position. This now gives us a standard order for these properties so in future it will be easy to know where everything should go.
  3. The schema may be updated – the export will update your theme.json schema to match the version of WordPress you are using, so if you theme was created with an older version of WordPress, the schema will be updated to match the version you are on.

How to submit a theme

Once you have your exported theme, you may need to make several changes before you can submit it to the theme repository.

  1. The screenshot will need to be updated, if you’ve made any visual changes to the homepage.
  2. You will have to add a changelog entry to the readme.txt file.
  3. You must update the version number of the theme in style.css.
  4. If this is a new theme, based on an existing theme, you will also need to update the name.
  5. If the theme doesn’t have a license file already you will need to add one.
  6. You will then need to rezip the theme with these changes.
  7. You can now submit the new zip file to https://wordpress.org/themes/getting-started/.

For more info see:

#6-0, #dev-notes, #dev-notes-6-0