7

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?

7

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.

  • +1 for the info. I didn't notice the last 2 post types. Btw, the TL;DR was longer than the original post (Kappa). – Jack Johansson Apr 13 '17 at 18:01
  • 2
    Beat me to it, I had the same idea with these two Make posts ;-) It would be nice to mention the authors of these posts too. – birgire Apr 13 '17 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.