Title: Database error when adding new posts
Last modified: August 20, 2016

---

# Database error when adding new posts

 *  Resolved [murtrd](https://wordpress.org/support/users/murtrd/)
 * (@murtrd)
 * [14 years ago](https://wordpress.org/support/topic/database-error-when-adding-new-posts/)
 * Seemingly out of nowhere, I can’t publish new posts or set featured images. When
   I go to the admin panel -> add new, I have a “submit for review” button instead
   of publish, and when I click set featured image, there is no “use this as featured
   image” link. I’ve been debugging the crap out of this, checked my debug.log, 
   and noticed the following error:
 * [14-May-2012 14:54:02] WordPress database error Unknown column ” in ‘field list’
   for query INSERT INTO `ums_wp_posts` () VALUES (”) made by wp_create_post_autosave,
   _wp_put_post_revision, wp_insert_post
 * Debugged some more, and found that in wp-admin/post-new.php if I pass get_default_post_to_edit(
   $post_type, false) instead of true (with the second parameter being $create_in_db
   via wp-admin/includes/post.php), I get the appropriate buttons. Meaning somewhere
   in this block of code (wp-admin/includes/post.php lines 418-427):
 *     ```
       if ( $create_in_db ) {
       		// Cleanup old auto-drafts more than 7 days old
       		$old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
       		foreach ( (array) $old_posts as $delete )
       			wp_delete_post( $delete, true ); // Force delete
       		$post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) );
       		// THE LINE OF CODE ABOVE IS WHATS CAUSING THE ERROR
       		$post = get_post( $post_id );
       		if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) )
       			set_post_format( $post, get_option( 'default_post_format' ) );
       ```
   
 * I’m getting an error, because I’m trying to insert blank data into a column with
   no name, which obviously makes no sense. Has anyone run into this? Any idea how
   to fix this? The site has been working fine for months, I haven’t installed any
   new plugins, and all of a sudden this is happening.

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years ago](https://wordpress.org/support/topic/database-error-when-adding-new-posts/#post-2746455)
 * Have you tried:
 * – deactivating **all** plugins to see if this resolves the problem. If this works,
   re-activate the plugins one by one until you find the problematic plugin(s).
 * – switching to the Twenty Eleven theme to rule out any theme-specific problems.
 * – [resetting the plugins folder](http://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F)
   by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause
   problems.
 * – re-uploading the wp-admin and wp-includes folders from a **fresh** download
   of WordPress.
 *  Thread Starter [murtrd](https://wordpress.org/support/users/murtrd/)
 * (@murtrd)
 * [14 years ago](https://wordpress.org/support/topic/database-error-when-adding-new-posts/#post-2746581)
 * It wasn’t really an option to deactivate all plugins at once and change themes
   since it would ruin the entire layout of the site. I ended up finding out the
   cause though. A plugin we had installed used the wp_insert_post_data filter and
   did not return $data, so in wp-includes/post.php::wp_insert_post, the result 
   of $data was an empty array, and mysql was confused.

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

The topic ‘Database error when adding new posts’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [post-new](https://wordpress.org/support/topic-tag/post-new/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [murtrd](https://wordpress.org/support/users/murtrd/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/database-error-when-adding-new-posts/#post-2746581)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
