maybe_add_column [ WordPress Function ]
maybe_add_column ( $table_name, $column_name, $create_ddl )
| Defined at: |
|
Benzer Fonksiyonlar: maybe_drop_column, image_add_caption, get_hidden_columns, _maybe_update_plugins, _maybe_update_core
* maybe_add_column() * Add column to db table if it doesn't exist.
- Returns: true if already exists or on successful completion
- false on error
Source
<?php
function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb;
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($column == $column_name) {
return true;
}
}
//didn't find it try to create it.
$q = $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
if ($column == $column_name) {
return true;
}
}
return false;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- PHPXRef 0.7 : WordPress : Function Reference: maybe_add_column()
Function and Method Cross Reference. maybe_add_column(). Defined at: /wp- admin/includes/upgrade.php -> line 1380 · /wp-admin/install-helper.php -> line ...
phpxref.ftwr.co.uk - PHPXRef 0.7 : WordPress : Detail view of upgrade.php
maybe_add_column() get_alloptions_110() __get_option() ...
phpxref.ftwr.co.uk - WordPress › Support » Subscribe2 : maybe_add_column()
I've just upgraded to 2.0.3 and wanted to add the Subscribe2 plugin (most recent version). This is the error message I get upon plugin activation: Fatal error: ...
wordpress.org - Docs for page install-helper.php
bool maybe_add_column (string $table_name, string $column_name, string $ create_ddl). string $table_name: Database table name; string $column_name: ...
phpdoc.wordpress.org