Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

Any help would be much apreciated

share|improve this question
add comment

3 Answers

Not sure if it would work but have you checked out Scribu's front-end editor?

http://scribu.net/wordpress/front-end-editor

or check this thread

http://wordpress.org/support/topic/front-end-custom-form-to-post?replies=5#post-1584286

share|improve this answer
    
Thanks for the help, but ive already ben through thoses resources and didnt find quite what I want. Is there any way to modify wherer the edit post page appears? –  Steven Baltay Sep 8 '11 at 23:32
add comment

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.

share|improve this answer
    
Thank you this is useful information. Is it possible to edit an existing post with a form? –  Steven Baltay Sep 10 '11 at 19:18
    
Yes, you can use the same basic concept with wp_update_post($args). Just add 'ID' => $post->ID to the $args array. I believe you can even use wp_insert_post as well to do this by supplying the post ID. –  Brian Fegter Sep 11 '11 at 4:23
    
Great so im off to a good start. My form can now save data to the title, description, and tag fields of a custom post, but my post also has custom fields created with the acf plugin. How can I save fields to a custom post field as well? –  Steven Baltay Sep 12 '11 at 23:57
    
It's actually very easy. You can use the return post ID value from $foo = wp_insert_post($args); add_post_meta($foo, 'awesome_key', 'awesome_value'); –  Brian Fegter Sep 13 '11 at 12:32
add comment

This is now possible with ACF. Just take a look at the documentation to see how to create a front-end form for both creating a new post and editing an existing one. http://www.advancedcustomfields.com/resources/tutorials/creating-a-front-end-form/

share|improve this answer
add comment

protected by Community Aug 6 '13 at 14:59

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.