Skip to content

Instantly share code, notes, and snippets.

@httpstersk
Created February 10, 2019 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save httpstersk/77369b6ea93d99ea5c8c4d694a2ed166 to your computer and use it in GitHub Desktop.
Save httpstersk/77369b6ea93d99ea5c8c4d694a2ed166 to your computer and use it in GitHub Desktop.
➋➍ Schedule a post for tomorrow (24 hours from now)
const { dispatch } = wp.data;
const { editPost } = dispatch( 'core/editor' );
const NOW = new Date();
const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000;
const TOMORROW = new Date( NOW.getTime() + ONE_DAY_IN_MS );
const schedulePost = date => editPost( { date } );
schedulePost( TOMORROW );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment