Title: Custom Post Types aren&#039;t created
Last modified: August 22, 2016

---

# Custom Post Types aren't created

 *  [johnprice672](https://wordpress.org/support/users/johnprice672/)
 * (@johnprice672)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/custom-post-types-arent-created/)
 * Hi,
 * I am experiencing and odd issue with custom post types.
 * I am using my own form.
 * I have created a custom post type (both using the types plugin and via functions.
   php)
 * I have a form field called ‘post_type’
 * When I put post/page or any random string of chars in to this field a post or
   page is created. With the random string a post is created.
 * If I put the custom post type in the field everything fails. My theme defaults
   to an ‘oops can’t find this page’ on form submit. (I have yet to try the default
   themes).
 * If I use the fix suggested in a previous comment:
    $post = array( ‘post_status’
   => ‘publish’, ‘post_type’ => ‘**testimonial**‘, ‘post_category’ => array(0) );
   removing the post_type field and everything works as expected.
 * I haven’t been able to try the logging suggested in the previous post, I will
   try this tomorrow.
 * Does any one have a better fix? I don’t want to lock this down to one custom 
   post type.
 * Thanks
    John
 * [https://wordpress.org/plugins/form-to-post/](https://wordpress.org/plugins/form-to-post/)

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

 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/custom-post-types-arent-created/#post-5874263)
 * Having a look at the code, post_type is not handled in any special way and it
   is simply passed into [wp_insert_post](http://codex.wordpress.org/Function_Reference/wp_insert_post).
   I assume the error is occurring in that function.
 *  [syndicate604](https://wordpress.org/support/users/syndicate604/)
 * (@syndicate604)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/custom-post-types-arent-created/#post-5874461)
 * When I tried a custom post type I also got 404 errors on submit FYI
 *  [syndicate604](https://wordpress.org/support/users/syndicate604/)
 * (@syndicate604)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/custom-post-types-arent-created/#post-5874462)
 * WP INSERT POST works fine, its either your plugin or CF7 which errors out with
   a 404 because the actual post creation process works pluperfect.
 * use CF7 to post to a category – works 100%
 * use CF7 to post to a hidden field called post-type – works but CF7 error handing
   is voided and the page returns a 404 after submission no matter what
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/custom-post-types-arent-created/#post-5874463)
 * Please post:
    (1) Your CF7 form definition (2) Same form input that causes the
   error
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/custom-post-types-arent-created/#post-5874464)
 * Try “post_type” not “post-type”
 * I tested this myself today using the plugin “Hidden Field for Contact Form 7”
   to add a hidden field to CF7 form. I used the field:
    `[simplehidden post_type"
   page"]`
 * and it successfully created a page instead of a post.

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

The topic ‘Custom Post Types aren't created’ 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/)

## Tags

 * [custom post](https://wordpress.org/support/topic-tag/custom-post/)

 * 5 replies
 * 3 participants
 * Last reply from: [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/custom-post-types-arent-created/#post-5874464)
 * Status: not resolved