A fresh wordpress install has the following post types:
- Post (Post Type: ‘post’)
- Page (Post Type: ‘page’)
- Attachment (Post Type: ‘attachment’)
- Revision (Post Type: ‘revision’)
- Navigation Menu (Post Type: ‘nav_menu_item’)
- Custom CSS (Post Type: ‘custom_css’)
- Changesets (Post Type: ‘customize_changeset’)
https://codex.wordpress.org/Post_Types doesn’t address what the final two are used for.
Could anyone explain?
1
The mentioned Post Types deal specifically with The Customizer.
Custom CSS Post Type
The custom_css
post type is used to store all themes “Custom CSS” content found in The Customizer under Additional CSS. Each theme gets it’s own post ( whenever the Additional CSS is saved ) with the CSS stored as post_content
. Then only the active theme’s post is used when displaying the theme. We can see that in action via wp_get_custom_css_post()
. You may read more about this decision by checking out the Make Core post created by contributor George Stephanis: Extending the Custom CSS Editor.
Changesets Post Type
This is a version of autosaves for The Customizer. You may read a more in-depth post by Weston Ruter: Customize Changesets Technical Design Decisions
The TL;DR for this post is that customize changesets make changes in the customizer persistent, like autosave drafts. For users, the customizer tab can be closed and re-opened and the changes will persist. Users can make changes to one theme and switch to another in the customizer without losing the changes upon switching. A customizer session can be bookmarked to come back to later or this URL can be shared with someone else to review and make additional changes (the URLs expire after a week without changes). The new APIs make possible many new user-facing features in future releases and feature plugins, including saving drafts, submitting changesets as pending for review, scheduling changes, and more.