xwp / wp-customize-snapshots

Customize Snapshots WordPress Plugin
https://wordpress.org/plugins/customize-snapshots/
52 stars 11 forks source link

Extend, integrate with and defer to changesets in WP 4.7 #99

Closed westonruter closed 7 years ago

westonruter commented 8 years ago

This is an important issue to complete before the 4.7 release in December.

The underlying architecture in snapshots was committed to core in WordPress 4.7-alpha. As such, the redundant code in snapshots should be only run if on 4.6 or less. All of the redundant code should be extracted into one or more back-compat classes.

Also, now that the post type is customize_changeset as opposed to customize_snapshot, there should be a data migration strategy. Also, any filters that apply on customize_snapshot_save should also apply onto customize_changeset_save_data.

Whenever a $_REQUEST['customize_snapshot_uuid'] is present we should during plugins_loaded make sure this gets mapped over to customize_changeset_uuid in $_GET, $_POST, and $_REQUEST.

In the end, the plugin should be reformulated to anticipate that more and more of the features of the plugin will be incorporated into core. So the more that we can facilitate turning off aspects of the code that are already in core, the better.

westonruter commented 8 years ago

I created a gist that has some light extensions for changesets to add some snapshots UI, just for testing. Some of the code may be helpful: https://gist.github.com/westonruter/b2c9edb9a2ee83236dd9b2b4f177ae76

The changesets post on Make/Core has some example API calls that should be used for creating drafts and scheduling changes via wp.customize.previewer.save(): https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/