WordPress.org

Ready to get started?Download WordPress

Forums

Unknown column 'post_category' in 'field list' (1 post)

  1. mcbethar
    Member
    Posted 3 years ago #

    Hello!

    I'm trying to use a script to import content for my articles directory website, but seems it was designed for WordPress v2.3.3 or older. My site is running under WordPress 3.0.1.
    I'm getting a "Unknown column 'post_category' in 'field list'" error message, and as I understand is due that from v2.8 post_category column was removed from wp_posts table.
    So I would need to fix this script to work on WordPress 3.0.1.

    This is the code I'm needing help to fix:

    mysql_connect($dbhost,$dbuser,$dbpasswd) or die(mysql_error());
    	mysql_select_db($dbname) or die(mysql_error());
    
    	$add_article = "INSERT INTO $db_article_table (" .
    		"<code>ID</code>, <code>post_author</code>, <code>post_date</code>, <code>post_date_gmt</code>, " .
    		"<code>post_content</code>, <code>post_title</code>, <code>post_category</code>, " .
    		"<code>post_excerpt</code>, <code>post_status</code>, <code>comment_status</code>, " .
    		"<code>ping_status</code>, <code>post_password</code>, <code>post_name</code>, " .
    		"<code>to_ping</code>, <code>pinged</code>, <code>post_modified</code>, <code>post_modified_gmt</code>, " .
    		"<code>post_content_filtered</code>, <code>post_parent</code>, <code>guid</code>, " .
    		"<code>menu_order</code>, <code>post_type</code>, <code>post_mime_type</code>, <code>comment_count</code> )" .
    		" VALUES " .
    		"(NULL, '1', '$posteddate', '$posteddateGMT', '$post_content', '$title', '', '$summary', 'draft', 'open', 'open', '', " .
    		"'$title', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0', '', '0', 'post', '', '0')";
    
    	mysql_query($add_article) or die(mysql_error());
    
    	if ($log_activity || $test_mode)	{
    		$string = "Article imported \n";
    		write_to_log( $string, $logfile ); 	}

    Could somebody help me to fix it?

    Thanks a lot in advanced! (and excuse my poor english since my native language is spanish.

Topic Closed

This topic has been closed to new replies.

About this Topic