2

I want to add frontend post to custom post types. Till now I have figured out how to do it but only to the regular post type(not custom post). I am using this code. (Couldn't paste it here hence please find it at Pastebin)

Need to know what code can be added to make the code applicable to custom post type(such as "books" or "places")

4
  • Have you tried changing Line 83? Change 'post_type' => 'post', to 'post_type' => 'YOURCUSTOMCPT', See Codex article for wp_insert_post for reference - codex.wordpress.org/Function_Reference/wp_insert_post Jul 29, 2014 at 13:57
  • That works. That was pretty clear, I'm kinda new to "Post types" and "frontend" so didn't get it. My apologies and Many thanks.
    – Sandeep
    Jul 29, 2014 at 14:09
  • @nothingtosee as an answer please :)
    – Rarst
    Jul 29, 2014 at 14:26
  • Cheers, I've added it as an answer, The Shawn can you mark as answered. Jul 29, 2014 at 22:46

2 Answers 2

2

Have you tried changing Line 83? Change 'post_type' => 'post', to 'post_type' => 'YOURCUSTOMCPT', See Codex article for wp_insert_post for reference - codex.wordpress.org/Function_Reference/wp_insert_post

-1

Did you try Gravity forms? http://www.gravityforms.com with this plugin http://wordpress.org/plugins/gravity-forms-custom-post-types/

1
  • 1
    Not yet. Its a paid plugin so sort of avoided it. Also it was easy to get and implement the aforementioned code for regular post(s), works perfectly. Just need to know what to add to make it applicable for custom post types.
    – Sandeep
    Jul 29, 2014 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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