Create and edit posts from front end

I’ve created a very nice custom post type using the fantastic ACF plugin, but now I need a way for users to submit posts from the front end. Plugins like Gravity forms and Front-end Editor are nice, but don’t work very well for this.

Is there a way that I can make the same Back-end edit form show up on a front end page? or alternatively Disguise part of the back-end site to look like the front-end?

Read More

Any help would be much apreciated

Related posts

Leave a Reply

3 comments

  1. What you’re asking for is not possible because of the security checks for user capabilities and admin referrer checks. It would be best for you to create a form on the front-end and use the wp_insert_post()

    if(isset($_POST['foo_bar'])):
    
        //Verify nonce and referrer
    
        //Validate data
    
        $args = array(
            'post_status' => 'draft',
            'post_content' => esc_html($content),
            'post_title' => esc_attr($title)
        );
    
        $foo = wp_insert_post($args);
    
        //If the post was inserted, wp_insert_post() will return the post ID of the new post
        if($foo)
           echo "bar";
    
    endif;
    
    //Create your form with a hidden nonce field here.
    
    1. You absolutely need to use nonces anytime you accept input.
    2. Use the built in WordPress escaping functions to secure input data after you validate it. http://markjaquith.wordpress.com/2009/06/12/escaping-api-updates-for-wordpress-2-8/

    I’ve built several forms like this using a static template as well as an AJAX version. It isn’t that hard to do. Just make sure you take every precaution to verify the integrity of the data and hide the input form from evil doers.