Front end post from file "outside" wordpress, (5 posts)

  1. GrundeLL
    Posted 4 years ago #


    So I've written a json / java / backbone app that will do a couple of translations and then i need to post it to the DB...

    The thing is that the file that I have as post file stands "outside" wp which makes the front end posting a little harder...

    What i wonder is simply how I should connect to and be able to post from a file outside the WP libary but still needs to go in to the WP post table.

    Would lobe to get some help.

    Best Regards

  2. michael.mariart
    Posted 4 years ago #

    The best way that I can think of is to use a home page template and add your extra code to that. If your theme doesn't have it, you can create a file called front-page.php and it will be used automatically for the sites home page layout.

  3. Tarsem Singh
    Posted 4 years ago #

    First of all Create a Page With Form for Post Values e.g. Title, Description, Category etc. and Extra Meta Data.

    Example Code ....

    $myPost = array(
        'post_title' => $_POST['postTitle'],
        'post_status' => $postStatus, //  @See http://wordpress.org/support/topic/post_status
        'post_author' => $userID, // you can set Post author ID at here eg. Current Logged in User see http://goo.gl/bsjPx
        'post_category' => array($_POST['category'])
    // Now Insert Post Data into DB
    $postId = wp_insert_post($myPost);
    // for custom Meta data
    add_post_meta($postId, 'duration', mysql_real_escape_string($_POST['duration']), true);
    add_post_meta($postId, 'country', mysql_real_escape_string($_POST['country']), true);

    Finally your post has been submitted.

  4. Tarsem Singh
    Posted 4 years ago #

  5. mikemayhem3030
    Posted 3 years ago #

    There's a chrome extension which you can use to post from anywhere on the web


    Might be useful, not sure it does exactly what you need though?

Topic Closed

This topic has been closed to new replies.

About this Topic