[wp-trac] [WordPress Trac] #30937: Add Customizer state persistence in changesets (formerly “transactions”)
WordPress Trac
noreply at wordpress.org
Sun Oct 9 20:46:52 UTC 2016
#30937: Add Customizer state persistence in changesets (formerly “transactions”)
-------------------------------------------------+-------------------------
Reporter: westonruter | Owner:
Type: feature request | westonruter
Priority: high | Status: assigned
Component: Customize | Milestone: 4.7
Severity: normal | Version:
Keywords: has-patch needs-testing needs-unit- | Resolution:
tests | Focuses:
-------------------------------------------------+-------------------------
Comment (by westonruter):
For how changesets facilitate the scheduling of changes, see
[https://core.trac.wordpress.org/ticket/28721#comment:12 comment] on
#28721:
> The infrastructure for this has been implemented in the patch for
#30937. […] There is no UI as part of the patch, so to test scheduling a
change to the site title in 5 minutes:
>
> 1. Change the `blogname` in the customizer to “Scheduled Title” and note
that that a `changeset_uuid` query param is added to the URL.
> 2. Open the console and (assuming your browser timezone is the same as
the blog's `timezone_string`):
> {{{#!js
> inOneMinute = (new Date( new Date().valueOf() + 5 * 60 * 1000 ));
> changesetDate = inOneMinute.getFullYear() + '-' + ( '00' + (
inOneMinute.getMonth() + 1 ) ).substr( -2 ) + '-' + ( '00' +
inOneMinute.getDate() ).substr( -2 ) + ' ' + ( '00' +
inOneMinute.getHours() ).substr( -2 ) + ':' + ( '00' +
inOneMinute.getMinutes() ).substr( -2 ) + ':' + ( '00' +
inOneMinute.getSeconds() ).substr( -2 );
> wp.customize.previewer.save( {
> status: 'future',
> date: changesetDate
> } )
> }}}
> 3. Assuming that WP Cron is running properly your environment, you
should see the new site title “Scheduled Title” at the designated time.
>
> Alternatively, here is how you can schedule a change using WP-CLI
without going into the customizer at all:
>
> {{{
> wp post create \
> --post_type=customize_changeset \
> --post_name=$( uuidgen ) \
> --post_status=future \
> --post_date="$( wp eval "echo get_date_from_gmt( gmdate( 'Y-m-d
H:i:s', time() + 5 * 60 ) );" )" \
> --post_content='{"blogname":{"value":"Scheduled Title"}}'
> }}}
>
> If WP Cron isn't firing, you can always `wp cron event run
publish_future_post`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30937#comment:69>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list