Add multiple columns in custom WordPress table if it does not exist -


this question has answer here:

i make plug-in in word press , create tables, during upgrading plug-in need add columns existing table, want add columns table if not exist in table.how can ?

you can use query (change table name , column name)

$row = $wpdb->get_results(  "select column_name information_schema.columns table_name = 'wp_customer_say' , column_name = 'say_state'"  );  if(empty($row)){    $wpdb->query("alter table wp_customer_say add say_state int(1) not null default 1"); } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -