Advertisement
willysec_id

Wordpress Secret API Add Article

Jun 19th, 2024
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | Cybersecurity | 0 0
  1. <?php  
  2. //20 June 2024 - @willygoid
  3. //Place this file to root directory of wordpress cms
  4. //Usage: Parameter to post 'key' => 'mi77i', 'title' => 'your title', 'content' => 'your content', 'date' => '20-06-2024', 'tags' => 'your post tags', 'type' => 'article'
  5. define('WP_USE_THEMES', false);  
  6. require_once("wp-load.php");  
  7. $key='mi77i';
  8. if($_POST['key']==$key){  
  9.     $categorys=explode(',',$_POST['category']);  
  10.     $category=array();  
  11.     for($x=1;$x<count($categorys);$x++) {  
  12.      $category[$x-1]=get_cat_ID($categorys[$x]);  
  13.     }  
  14.     $info = array(  
  15.     'post_title' => $_POST['title'],  
  16.     'post_content' => $_POST['content'],  
  17.     'post_status' => 'publish',  
  18.     'post_author' => 1, //Author ID of the published article, 1 is the administrator  
  19.     'post_date' => $_POST['date'],  
  20.     'tags_input' => $_POST['tags'],  
  21.     'post_category' => $category,  
  22.     'post_type' => $_POST['type']  
  23.     );  
  24.     wp_insert_post( $info );  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement