Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //20 June 2024 - @willygoid
- //Place this file to root directory of wordpress cms
- //Usage: Parameter to post 'key' => 'mi77i', 'title' => 'your title', 'content' => 'your content', 'date' => '20-06-2024', 'tags' => 'your post tags', 'type' => 'article'
- define('WP_USE_THEMES', false);
- require_once("wp-load.php");
- $key='mi77i';
- if($_POST['key']==$key){
- $categorys=explode(',',$_POST['category']);
- $category=array();
- for($x=1;$x<count($categorys);$x++) {
- $category[$x-1]=get_cat_ID($categorys[$x]);
- }
- $info = array(
- 'post_title' => $_POST['title'],
- 'post_content' => $_POST['content'],
- 'post_status' => 'publish',
- 'post_author' => 1, //Author ID of the published article, 1 is the administrator
- 'post_date' => $_POST['date'],
- 'tags_input' => $_POST['tags'],
- 'post_category' => $category,
- 'post_type' => $_POST['type']
- );
- wp_insert_post( $info );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement