Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. $postTitle = $_POST['post_title'];
  3. $post = $_POST['post'];
  4. $submit = $_POST['submit'];
  5.  
  6. if(isset($submit)){
  7.  
  8. global $user_ID;
  9.  
  10. $new_post = array(
  11. 'post_title' => $postTitle,
  12. 'post_content' => $post,
  13. 'post_status' => 'publish',
  14. 'post_date' => date('Y-m-d H:i:s'),
  15. 'post_author' => $user_ID,
  16. 'post_type' => 'post',
  17. 'post_category' => array(0)
  18. );
  19.  
  20. wp_insert_post($new_post);
  21.  
  22. }
  23.  
  24. ?>
  25. <!DOCTYPE HTML>
  26. <html>
  27. <head>
  28. <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
  29. <title>Untitled Document</title>
  30. </head>
  31.  
  32. <body>
  33. <div id="wrap">
  34. <form action="" method="post">
  35. <table border="1" width="200">
  36. <tr>
  37. <td><label for="post_title">Post Title</label></td>
  38. <td><input name="post_title" type="text" /></td>
  39. </tr>
  40. <tr>
  41. <td><label for="post">Post Content</label></td>
  42. <td><input name="post" type="text" /></td>
  43. </tr>
  44. </table>
  45.  
  46. <input name="submit" type="submit" value="submit" />
  47. </form>
  48. </div>
  49.  
  50. </body>
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement