[wp-trac] [WordPress Trac] #28721: Scheduled changes for the customizer

WordPress Trac noreply at wordpress.org
Sun Oct 9 06:45:06 UTC 2016


#28721: Scheduled changes for the customizer
-----------------------------+-----------------------------
 Reporter:  danielbachhuber  |       Owner:
     Type:  enhancement      |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  Customize        |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:
-----------------------------+-----------------------------

Comment (by westonruter):

 The infrastructure for this has been implemented in the patch for #30937.

 To test, first do `grunt patch:https://github.com/xwp/wordpress-
 develop/pull/161`.

 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/28721#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list