Skip to content

Instantly share code, notes, and snippets.

@lewayotte
Last active January 12, 2016 14:46
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 lewayotte/cf51cb765baf2e77bed0 to your computer and use it in GitHub Desktop.
Save lewayotte/cf51cb765baf2e77bed0 to your computer and use it in GitHub Desktop.
Delay WP Robot posts by 3 minutes for leenk.me's use
<?php
function setup_wprobot_filters_for_leenkme( $content, $title, $catarray ) {
add_filter( 'wp_insert_post_data', 'delay_wp_robot_posts_by_3_minutes_for_leenkme', 10, 2 );
}
add_action( 'wpr_before_post_save', 'setup_wprobot_filters_for_leenkme', 10, 3 );
function delay_wp_robot_posts_by_3_minutes_for_leenkme( $data, $postarr ) {
if ( 'publish' === $data['post_status'] ) {
$data['post_status'] = 'future';
$data['post_date'] = date( 'Y-m-d H:i:s', strtotime( '+3 minutes', current_time( 'timestamp' ) ) );
$data['post_date_gmt'] = get_gmt_from_date( $data['post_date'] );
}
return $data;
}
@lewayotte
Copy link
Author

This is technically untested... but it should work, in theory :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment