Does dbDelta delete columns as well?

As far as I know, dbDelta() is primarily used to add tables to the database. It can also add or alter columns. To delete columns, you should use $wpdb->query():

global $wpdb;
$table = $wpdb->prefix . 'table_name';
$wpdb->query( "ALTER TABLE $table DROP COLUMN column_name" );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)