Title: Custom Post Type Saving as Draft
Last modified: August 21, 2016

---

# Custom Post Type Saving as Draft

 *  [markd33](https://wordpress.org/support/users/markd33/)
 * (@markd33)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/custom-post-type-saving-as-draft/)
 * Hello, I’ve run into an odd issue that I haven’t been able to find a solution
   for.
 * I have a custom post type that has been created (along with several others), 
   yet every time a new post is created and published it only saves it as a draft.
   However, if I use quick edit from the menu I can change the published status 
   to published and save it and that works.
 * The odd thing is I’m using very similar code for several other custom post types
   and they all work fine and this was working originally and only recently started
   not working. I can’t find any solutions on the web so I’m requesting assistance.
 * Also, I should note that the post does save, it just saves as draft.
 * Register Hook
 *     ```
       register_post_type( 'speakerbooks', array (
       	'description'			=> 'Speaker Books',
       	'show_ui'				=> true,
       	'menu_position'			=> 7,
       	'exclude_from_search'	=> false,
       	'supports'				=> array( 'title', 'editor'),
       	'public'				=> false,
       	'rewrite'				=> array(
       		'slug' => 'speakerbooks',
       		'with_front' => 'false'
       	),
       	'labels'				=> array(
       		'name'			=> 'Speaker Books',
       		'singular_name'	=> 'Speaker Book',
       		'add_new'		=> 'Add New Book',
       		'add_new_item'	=> 'Add New Book',
       		'edit'			=> 'Edit Book',
       		'edit_item'		=> 'Edit Book',
       		'new_item'		=> 'New Book',
       		'view'			=> 'View Books',
       		'view_item'		=> 'View Book',
       		'search_items'	=> 'Search Books',
       		'not_found'		=> 'No books found.',
       		'not_found_in_trash'	=> 'No books found in the trash.'
       	),
       	'register_meta_box_cb' => 'add_speakers_metaboxes'
   
       ) );
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [markd33](https://wordpress.org/support/users/markd33/)
 * (@markd33)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/custom-post-type-saving-as-draft/#post-4885688)
 * I found a solution on my own to override the save function that fixes it but 
   I still can’t figure out why it is even happening to begin with. This required
   adding this to the end of my save_post function.
 *     ```
       // original publish override to fix a bug that was preventing speaker books from publishing on save
       if (isset($_REQUEST['original_publish']) && $_REQUEST['original_publish'] == 'Publish') :
       	$poststatus =  $_REQUEST['original_publish'];
       	// // // unhook this function so it doesn't loop infinitely
       	remove_action( 'save_post', 'cpt_save_post' );
   
       	// // // update the post, which calls save_post again
       	wp_update_post( array( 'ID' => $post->ID, 'post_status' => $poststatus ) );
   
       	// // // re-hook this function
       	add_action( 'save_post', 'cpt_save_post' );
       endif;
       ```
   

Viewing 1 replies (of 1 total)

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

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [markd33](https://wordpress.org/support/users/markd33/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/custom-post-type-saving-as-draft/#post-4885688)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
