Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: API Page
- */
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $title = $_POST['title'];
- $content = $_POST['content'];
- $pub_time = $_POST['publish_time'];
- $postdate = date($pub_time);
- $postdate_gmt = date($pub_time);
- $post = array(
- 'post_title' => ucfirst($title),
- 'post_name' => strtolower(sanitize_title($title)),
- 'post_content' => $content,
- 'post_status' => 'future',
- 'post_type' => 'post',
- 'post_author' => '1',
- 'post_date_gmt' => $postdate_gmt,
- 'post_date' => $postdate,
- );
- wp_insert_post($post);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement