Title: Custom Post Type
Last modified: August 21, 2016

---

# Custom Post Type

 *  Resolved [psperkins](https://wordpress.org/support/users/psperkins/)
 * (@psperkins)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/custom-post-type-42/)
 * Setting the hidden field value to the name of the custom post type does not seem
   to be working for me.
 * I have a post type named “lost_thing” and I am using a hidden field with CF7 
   Modules like so: [hidden post_type “lost_thing”] but every time I submit it it
   makes a “page” post type and not my custom one.
 * Any ideas?
 * [http://wordpress.org/plugins/form-to-post/](http://wordpress.org/plugins/form-to-post/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [s.p.buckle](https://wordpress.org/support/users/spbuckle/)
 * (@spbuckle)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/custom-post-type-42/#post-4001683)
 * Hi psperkins,
 * I needed to do the same thing and could only find a solution where i changed 
   the core files of the plugin (not advised, but I had no choice).
 * In the ‘Form to Post’ plugin folder there is a file called ‘FormToPost_Plugin.
   php’ .. on line 142 there is some code as followed:
 *     ```
       $post = array(
                   'post_status' => 'publish',
                   'post_type' => 'post',
                   'post_category' => array(0)
               );
       ```
   
 * Change ”post_type’ => ‘post’,’ to whatever you need… worked for me!
 *  Thread Starter [psperkins](https://wordpress.org/support/users/psperkins/)
 * (@psperkins)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/custom-post-type-42/#post-4001684)
 * Yeah that was what I ended up doing as well. Was hoping for something more…#AHEM…
   elegant I guess.
 * Thanks for your input though!
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/custom-post-type-42/#post-4001691)
 * This is a mysterious bug. The code you cite is just setting default values for
   post status, type & category in case they are not set in the form. These are 
   overwritten a little further down in the code:
 *     ```
       // Add in any additional fields
               foreach ($simpleFields as $field) {
                   if (isset($cf7->posted_data[$field])) {
                       $post[$field] = stripslashes($cf7->posted_data[$field]);
                   }
               }
       ```
   
 *  (where $simpleFields includes post_status, etc.)
 * Since I cannot reproduce this behavior, I would be interested if someone having
   this issue would inject a call to write out the contents of $cf7->posted_data
   to a log file to see if you are in fact getting post_status.
 * You could do this by adding this line:
    `error_log('Form Submission: ' . print_r(
   $cf7, true));`
 * and create a wp-content/plugins/contact-form-7-to-database-extension/php.ini 
   file with an line that points to a where a log files should be written:
    `error_log
   =/path/to/error_log.txt`
 *  [unitedwebsoft1](https://wordpress.org/support/users/unitedwebsoft1/)
 * (@unitedwebsoft1)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/custom-post-type-42/#post-4001705)
 * Hi,
    Here is a great tutorial on WordPress custom post type add form in frontend
   [http://unitedwebsoft.in/blog/wordpress-custom-post-type-add-form-in-frontend-for-users/](http://unitedwebsoft.in/blog/wordpress-custom-post-type-add-form-in-frontend-for-users/).
   also added to custom taxonomy with image upload field.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Custom Post Type’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/form-to-post.svg)
 * [Form to Post](https://wordpress.org/plugins/form-to-post/)
 * [Support Threads](https://wordpress.org/support/plugin/form-to-post/)
 * [Active Topics](https://wordpress.org/support/plugin/form-to-post/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/form-to-post/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/form-to-post/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [unitedwebsoft1](https://wordpress.org/support/users/unitedwebsoft1/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/custom-post-type-42/#post-4001705)
 * Status: resolved