Last active
January 12, 2016 14:46
-
-
Save lewayotte/cf51cb765baf2e77bed0 to your computer and use it in GitHub Desktop.
Delay WP Robot posts by 3 minutes for leenk.me's use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is technically untested... but it should work, in theory :).