How to post outside wordpress ?? (1 post)

  1. n3v3rl0v3
    Posted 5 years ago #

    I am really confused and messed up now a days in solving this up.
    I am getting post_title, post_content and other things in $_REQUEST... as well as an image file. I want to save all that as a post in wordpress database. Can u help me up?
    here is what m getting on my page.......
    $user_ID; //getting it from my function
    $post_title = $_REQUEST['post_title'];
    $post_content = $_REQUEST['post_content'];
    $post_cat_id = $_REQUEST['post_cat_id']; //category ID of the post
    $filename = $_FILES['image']['name'];

    //I got this all in a array

    $postarr = array(
    'post_status' => 'publish',
    'post_type' => 'post',
    'post_title' => $post_title,
    'post_content' => $post_content,
    'post_author' => $user_ID,
    'post_category' => array($category)
    $post_id = wp_insert_post($postarr);


    I dont know what to do next :(. This will get all the things in database as post. but what about attachment and its post meta .??? can anybody help me up?

Topic Closed

This topic has been closed to new replies.

About this Topic