0

Trying to alter a database in Wordpress and adding new columns to it. Here is the code:

function new_columns_users(){

    global $wpdb;
    $charset_collate = $wpdb->get_charset_collate();
    $table_name = $wpdb->prefix . "users";

    $sql = "ALTER TABLE $table_name ADD (
        gender varchar(10),
        test varchar(10)
        ) $charset_collate;";

    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    dbDelta( $sql );
}

This doesn't add the new columns in the database. I feel like I tried everything, what is wrong with this query?

Julien Rousé
  • 1,115
  • 1
  • 15
  • 30
Willem van der Veen
  • 33,665
  • 16
  • 190
  • 155

0 Answers0