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.

Where would I start if I want to have a custom post created each time data was submitted from a form on the front page for non-logged in users? I have the script set up to send the data to a custom table, and to retrieve the data. I would like to put a function into a conditional that would create a post of the data that is submitted. again, the constraints would be a form on the front page or any user-facing page for non-logged in users.

share|improve this question
    
Did you have a look at wp_insert_post(). Link: codex.wordpress.org/Function_Reference/wp_insert_post –  Maruti Mohanty Dec 9 '13 at 8:52

1 Answer 1

I'm not sure I understand your question, but I think you're asking how do you create a post from a form thats submitted by a user?

These tutorials might help: http://wp.tutsplus.com/tutorials/allow-users-to-submit-images-your-site/ or http://wp.tutsplus.com/tutorials/allow-users-to-submit-to-your-wordpress-site-a-quotes-plugin/

It shows how to create post from a forms input.

For the conditional part, if you want them to be logged in use this:

if(!is_user_logged_in()) {
  return '<p>You need to be logged in to do whatever this is....</p>'; 
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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