Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // http://www.gravityhelp.com/forums/topic/form-date-field-publish-date#post-71477
- // the 10 (priority), 2 (arguments) is documented here http://codex.wordpress.org/Function_Reference/add_filter
- // change the 64 here to your form ID
- add_action('gform_after_submission_64', 'set_schedule_date', 10, 2);
- function set_schedule_date($entry, $form){
- // get the post
- $post = get_post($entry['post_id']);
- // see note here http://codex.wordpress.org/Function_Reference/wp_update_post#Scheduling_posts
- $post->edit_date = true;
- // make sure it really is pending
- $post->status = 'pending';
- // change post schedule date in format [Y-m-d H:i:s] based on input from the entry
- // be sure to change the 18 here to your date input field
- $post->post_date = date('Y-m-d H:i:s', strtotime($entry['18']));
- // update the post
- wp_update_post($post);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement