Pippins Plugins
  • Email
  • Facebook
  • Feedburner
  • Github
  • Google
  • Twitter
  • Vimeo
  • Youtube
  • Rss
  • About
  • News
  • Join the Site
    • Member Benefits
    • Member Plugins
    • Email Notifications
  • Plugin Store
    • Affiliate Area
    • Checkout
  • Plugins
    • Plugin Portfolio
      • Plugin Portfolio – List View
    • Free
    • Premium
    • Member Plugins
    • Coding Standards
    • Get Plugin Support
  • Tutorials
    • Series
      • Plugin Development 101
      • Creating a User Follow System Plugin
      • Customizing Restrict Content Pro
      • Displaying Content with Easy Content Types
      • Writing Your First WordPress Plugins, Basic to Advanced
      • Working with Widgets
      • User Submitted Image Galleries
      • Plugin Thoughts
      • Integrating Stripe.com with WordPress
      • WordPress Rewrite API
    • Member Exclusive
      • Free Members
      • Subscriber Only
    • Difficulty
      • Beginner
      • Intermediate
      • Advanced
    • Action and Filter Hooks
    • Ajax
    • Custom Post Types
    • External APIs
    • Short Codes
    • Taxonomies
    • Video Tutorials
    • Widget Tutorials
    • WordPress Admin / Dashboard
    • Working with jQuery
    • WordPress Database
    • Writing Plugins
    • Tag Index
  • Reviews
  • Support Forum
  • Contact
    • Support the Site
    • Request Code Review
    • Plugin Support

Custom Front End Post Submission Form

Posted on April 23, 2012 by Pippin in Advanced, Custom Post Types, Member Restricted, Subscriber Only, Tutorials, Writing Plugins 24 Comments
Home» Tutorials » Advanced » Custom Front End Post Submission Form
Tweet
Love It - 5

In the Jobs Posting with Easy Content Types and Gravity Forms tutorial, we used Gravity Forms to create a submission form for users to post their job openings. In this tutorial, we are going to create our own custom submission form. While we will focus the form around job submission, the techniques used here apply to all post/page/custom post type front end submission forms.

The process for creating a front-end submission form for posts, pages, or custom post types is actually quite simple, even though it is often thought of as being very difficult. There are just two major components to a front-end submission form:

  1. An HTML form for the data to be entered into
  2. A function that listens for the form submission and then processes the submitted data

The code written in the video, which consists of just two functions, is less than 80 lines and contains everything needed for a pretty decent front-end submission form, even if it is pretty basic. It introduces everything you need to know for getting started with building these kinds of forms and opens up the door to countless possibilities.

You must be logged in and have an active premium membership to view the rest of this content. Register or login from the sidebar.

Tweet Follow @pippinsplugins
add_action, add_shortcode, update_post_meta, wp_insert_post

24 comments on “Custom Front End Post Submission Form”

  1. paul says:
    April 23, 2012 at 3:01 pm

    great tutorial, thanks!
    I didn’t think it was as simple as that. thanks for showing how to pass the parameters between pages too, that will be useful.
    any plans for a server side validation tutorial?

    Reply
    • Pippin says:
      April 23, 2012 at 3:06 pm

      Thanks! I will definitely plan on doing some server side validation at some point.

  2. paul says:
    April 23, 2012 at 3:01 pm

    great tutorial, thanks!
    I didn’t think it was as simple as that. thanks for showing how to pass the parameters between pages too, that will be useful.
    any plans for a server side validation tutorial?
    would be cool to enable AJAX too

    Reply
    • Pippin says:
      April 23, 2012 at 3:06 pm

      Ajax would be good too :)

  3. mila says:
    April 24, 2012 at 4:31 pm

    So I did it!
    http://www.mywpacademy.com/wordpress-content-management-system-expert-trainer-washington-dc-va-md/project-listing/

    But after building a very complicated front-end edit form – I am thinking that I can use the same custom form for the initial entry as well…
    Good info though!

    -iryna

    Reply
    • Pippin says:
      April 24, 2012 at 9:39 pm

      Great job!

    • Andrew says:
      June 16, 2012 at 2:49 pm

      Great work, love the site.

      I’m from the UK so no point me joining but would love to know what was involved in the way you setup an events calendar looking so good and also the sumbmission.

    • Pippin says:
      June 16, 2012 at 6:21 pm

      Why does being from UK make it so there is no point in signing up? I’m not trying to tell you to signup, I’m just curious about your logic :)

      Can you tell me what you are looking at for the events calendar?

    • Andrew says:
      June 17, 2012 at 8:41 am

      Hi there Pippin, slight confusion here I have caused.

      I was referring to the signing up of mywpacademy which has a lot of usa based courses.

      No problem joining your site, still studying what’s already available on your site. I’ve learnt a lot from your site already about gravity forms which could get me half way there. :-)

      I like the way the calendar has all these custom search options. http://www.mywpacademy.com/washington-dc-wordpress-web-development-events-calendar/#.T93ck1LNlIY

      I’ve always wanted to find a way to create an events website for my local area but I’m not a programmer and dedicated scripts I have seen don’t do what is need so I would prefer to find a way using wordpress.

      The calendar setup is good and so is the open form for submissions.

    • Pippin says:
      June 17, 2012 at 6:39 pm

      Ah, makes much more sense now :)

      Your best bet is to go with a plugin like this one: http://tri.be/wordpress-events-calendar/

      They have a free and pro version.

  4. jasonbahl says:
    May 3, 2012 at 7:03 pm

    Does wp_nonce_field and wp_verify_nonce work on multisite?

    For instance, if I have a form on a “child site” and need to submit it so the data will be collected in the parent site, will wp_nonce_field and wp_verify_nonce work, as the child site and parent site are on the same database? Or would there be some other solution to securely capture data from a child site and store it in the parent site?

    What about using wp_nonce_field and wp_verify_nonce on separate sites on the same server?

    For instance Site A has a form that will collect data and store it in Site B. Both sites are on the same server, but are different wordpress installations. Is there a way to securely pass the data from a form on Site A, and have it collected in the database of Site B?

    Reply
    • Pippin says:
      May 4, 2012 at 9:58 am

      Hmm, that’s a really good question. I think it will work, but really couldn’t say without trying it.

      For passing data back and forth between sites, you should look at the switch_to_blog() and restore_current_blog() functions. They are extremely simple to use, but very cool.

  5. joe2012 says:
    May 28, 2012 at 5:12 am

    thanks a lot

    Reply
  6. crsneilhedley says:
    July 1, 2012 at 6:18 am

    Would love to read this. Site tells me to register first. So I do. Come back, site tells me to log in. So I do. I’m now logged in, and the post says I can’t read the rest until I log in.
    Hopefully the code in the tutorial works better than this.

    Reply
    • Pippin says:
      July 1, 2012 at 8:25 pm

      This is a premium tutorial. You have registered for a free account. If you want to access this tutorial, you must upgrade to a paid account.

  7. turtlepod says:
    July 23, 2012 at 10:30 am

    great tutorial.
    pippin, is there a way to use akismet to filter spam for email input and description (content) input ?

    Reply
    • Pippin says:
      July 23, 2012 at 1:09 pm

      No, not that I’m aware of. The best thing to do, probably, would be to enable reCaptcha or add in a simple math verification system.

  8. turtlepod says:
    July 25, 2012 at 7:15 am

    thanks.
    i hate captcha :)
    i think it’s possible, but haven’t try it yet.
    just incase someone else find this interesting:
    i found a tuts http://andrewbleakley.com/protecting-your-contact-form-from-spam/
    and contact form 7 have this feature too,
    http://contactform7.com/spam-filtering-with-akismet/

    Reply
    • Pippin says:
      July 25, 2012 at 9:06 am

      I should rephrase my answer to say Im’ sure it’s possible, I just have no idea how to do it :D

  9. Vinnysingh says:
    September 3, 2012 at 11:13 am

    This is a great tutorial! Thanks alot!

    Also, be able to create posts is amazing for the front end, but what about moving a post to the Trash, how would we go about doing that?

    Reply
    • Pippin says:
      September 3, 2012 at 11:20 am

      You can use wp_delete_post() to remove a post (or place it in the trash).

    • Vinnysingh says:
      September 3, 2012 at 11:23 am

      Yeahh, I’ve seen that but the tricky part is how to get it to run for when you click on a href link, because I have a list of all posts in 1 loop, and lets say for example you wish to delete the 3rd post within the list, but that function just deletes all posts when used within the loop.

    • Pippin says:
      September 4, 2012 at 11:35 am

      Use add_query_arg() and then attach a function to the “init” hook that watches for the query args.

    • Vinnysingh says:
      September 8, 2012 at 8:21 am

      You could also use: get delete post link

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Login

Lost your password?

Please enter your username or e-mail address. You will receive a new password via e-mail.

  • Facebook Become a Fan Like

  • Twitter Subscribe on Twitter Follow

  • YouTube Follow my Videos Subscribe

  • RSS Feed Subscribe with RSS Subscribe

Easy Digital Downloads

Most Loved

  • Love It Pro for WordPress
  • Write a “Love It” Plugin with Ajax to Let Users Love Their Favorite Posts / Pages
  • Simple Notices Pro Plugin for WordPress
  • User Bookmarks for WordPress
  • Front End Registration and Login Forms Plugin

Similar Plugins and Posts

  • Plugin Development 101 – Intro to Actions
  • Stripe Integration Part 9 – The Stripe Button
  • Using pre_get_posts to Modify Queries for Meta Data and More
  • Let’s Talk Extensible Code
  • Create a Live Search in WordPress with jQuery and Ajax

Latest Premium Content

  • Plugin Development 101 – Introduction to Adding Dashboard Menus
  • Plugin Development 101 – Intro to Loading Scripts and Styles
  • User Follow System – Part 5
  • Plugin Development 101 – Intro to Short Codes

Latest Tutorials

  • Storing Session Data in WordPress without $_SESSION (19)

    The term Session in web development refers to...

  • Test Your Plugins with RTL (1)

    Right-To-Left languages are those that...

  • Submitting Your First Pull Request to a WordPress Plugin on Github (5)

    Github is an extremely popular tool for managing WordPress plugins, and one...

Enter your email to receive automated updates when new posts are published

WP Core Contributions

  • [24316]

View the ticket on Trac.

WP Codex Contributions

  • Function: shortcode exists
  • Function: has shortcode
  • Function: shortcode exists
  • Function: shortcode exists
  • Function: has shortcode

View all 41 changes in the Codex.

Latest Tweets

  • Could not fetch Twitter RSS feed.

Topics

campaign monitor add_options_page hook get_user_meta Rémi Corson the_content meta box register_setting Sugar Event Calendar attachments wp_enqueue_script contextual help shortcodes authors Related posts attachment image forms do_action plugin mail chimp login short codes comments recent posts post types apply_filters short code bbpress taxonomies custom post type gallery images Ajax Stripe taxonomy jquery widgets users add_filter easy content types add_action widget restrict content pro easy digital downloads

Weekly Newsletter

Useful Links

  • Join the Site
  • Plugin Store
  • Affiliate Area
  • Tag Index
  • Support the Site
  • Suggest a Tutorial
  • Random Post
  • Contact

Monthly Archives

(c) 2013 Pippin's Plugins