1
  • I want to write a post today (2019-01-15)
  • I want to schedule the publication for the future (2020-09-03)
  • I want the published date to reflect when it was originally written - so it appears as example.com/2019/01/slug - or an arbitrary date in the past.

Can anyone suggest how I might do this?

1

I'm afraid it won't be possible without any coding, but... It shouldn't be so hard to achieve.

I would approach it this way:

  1. Schedule post for publication using native post date.
  2. Store the real publication date as some custom field.
  3. Add custom action to transition_post_status hook and replace the publish date with the one stored in custom field.

.

function replace_publish_date( $new_status, $old_status, $post ) {
    if ( 'publish' == $new_status && 'future' == $old_status ) {
        wp_update_post( array(
            'ID' => $post->ID, 
            'post_date' => get_post_meta( $post->ID, 'real_publish_date', true )
        ) );
    }
}
add_action( 'transition_post_status', 'replace_publish_date', 10, 3 );

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.