[wp-hackers] Recommended way to change column name

Angelo Verona anilo4ever at gmail.com
Sun May 30 20:40:34 UTC 2010

> ------------------------------
> Message: 2
> Date: Sun, 30 May 2010 07:55:02 -0400
> From: "Mike Walsh" <mike_walsh at mindspring.com>
> Subject: [wp-hackers] Recommended way to change column name?
> To: <wp-hackers at lists.automattic.com>
> Message-ID: <000a01caffee$efd1e4d0$cf75ae70$@com>
> Content-Type: text/plain;	charset="us-ascii"
> I have a plugin which has its own tables.  One of the tables I had created a
> while back for some future functionality that I am just getting to
> implementing.  In the course of working on it I decided that I didn't need
> several of the columns and more importantly, I wanted to change the name of
> the primary index column to be more descriptive than the generic "id" name I
> gave it originally.
> I use dbDelta() to create my tables.  So I changed the SQL to reflect the
> new updated table I wanted but the call to dbDelta() doesn't seem to have
> any affect other than adding columns.  Doing some searching it appears
> dbDelta() has some limitations and I am wondering if changing column names
> is one of them.  Because I have never used this table I suppose I could
> check for existence and drop it and let dbDelta() recreate it but I am
> wondering what the recommended way to make table changes is?
> Thanks,
> Mike

use this to register header and footer of your table:

register_column_headers($current_screen, array( 'cb' => '<input type="checkbox">', 'title' => "Title", 'author' => "Author", 'categories' => "Categories", 'date' => "Date"));

and use this to print your header inner table:

<?php print_column_headers( $current_screen );  ?>

More information about the wp-hackers mailing list