/** * Get the next scheduled repeat post * * @param int $post_id The id of a repeat or repeating post * @return Int|Bool Return the ID of the next repeat post_id or false if it can't find one */ function get_next_scheduled_repeat_post($post_id) { $post = get_post(get_repeating_post($post_id)); $repeat_posts = get_posts(array('post_status' => 'future', 'post_parent' => $post->ID)); if (isset($repeat_posts[0])) { return $repeat_posts[0]; } return false; }
function test_create_get_repeating_post() { $parent_post_id = $this->factory->post->create(); $post_id = $this->factory->post->create(array('post_parent' => $parent_post_id)); save_post_repeating_status($parent_post_id, 'weekly'); $this->assertEquals($parent_post_id, get_repeating_post($parent_post_id)); $this->assertEquals($parent_post_id, get_repeating_post($post_id)); }