diff --git a/php/class-db.php b/php/class-db.php index b243f4c6..874834e3 100644 --- a/php/class-db.php +++ b/php/class-db.php @@ -135,6 +135,13 @@ function create_table( $table_name ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta( $sql ); - do_action( 'code_snippets/create_table', $table_name ); + + $success = empty( $wpdb->last_error ); + + if ( $success ) { + do_action( 'code_snippets/create_table', $table_name ); + } + + return $success; } }