Hi,

I have a question that I've been thinking about for a long time.

How can you assure yourself that you've fully comprehended a concept or the true meaning of a theorem in mathematics?

I mean how can you realize that you totally get the concept and it's time to move on to the next pages of the book you're reading?

Thanks in advance for your responses.


Question: Front end submit form with jquery form plugin
Answer: Leave the action value as blank. Give the submit button a name as name='form_sub'. Then add the following code to your functions.php file. Check the codex for init hook. 
You can create a 'Thank You' page, or a confirmation page where the user should go after successful submission.

&lt;?php
add_action('init', 'form_submit');

function form_submit(){
    if(isset($_POST['form_sub']))
    {
        //here you'll have your form data in a $_POST array, you can check it using a print_r. parse the form and insert the post
        $title = $_POST['name'];
        $content = $_POST['comment'];

        //change the category and author as you want
        $post_obj = array(
                        'post_title' =&gt; $title,
                        'post_content' =&gt; $content,
                        'post_category' =&gt; array(1), //Uncategorized
                        'post_status' =&gt; 'draft',
                        'post_author' =&gt; 1 //Admin
                       );
        $id = wp_insert_post($post_obj);

        //check if successfully submitted
        if(isset($id) &amp;&amp; !is_wp_error($id))
        {
            //redirect to a thank you page, make sure the slug is 'thank-you'
            wp_redirect(home_url('/thank-you'));
            exit;
        } 
    }
}
?&gt;


Try this. Let me know if you are stuck.

Edit:
This is how the form template should be. The submit button should have the name attribute, not the form.

&lt;?php /* Template Name: Submit */ ?&gt; 
&lt;?php get_header(); ?&gt; 
Form this: 
&lt;form action="" method="post"&gt; 
    Name: &lt;input type="text" name="name" /&gt; 
    Comment: &lt;textarea name="comment"&gt;&lt;/textarea&gt;
    &lt;input type="submit" value="Submit" name="form_sub" /&gt;
&lt;/form&gt;
&lt;?php get_footer(); ?&gt;