Run dbDelta
for each SQL statement seperately:
function myplugin_install(){
global $wpdb;
$table_name = $wpdb->prefix . "vehicles";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
$sql = "CREATE TABLE IF NOT EXISTS $table_name
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
description VARCHAR(25) NOT NULL,
PRIMARY KEY (id)
);
";
dbDelta($sql);
$sql2 = "CREATE TABLE IF NOT EXISTS $table_name1
(
...
)";
dbDelta($sql2);
$sql3 = "CREATE TABLE IF NOT EXISTS $table_nameX
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT ,
art_alarmierung VARCHAR(25) NOT NULL ,
PRIMARY KEY (id)
);";
dbDelta($sql3);
}
Related Posts:
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- Correct way to perform non-cacheable DB query
- Help With MySQL to WPDB Query Conversion
- Creating mySQL procedure with $wpdb
- Change commission_status paid when withdraw_status vendor is completed
- Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working
- WPDB: Update table
- Issue running db create table query from static method
- Displaying data from another database
- How to securely controlling data without keeping it in postmeta?
- Using id to show item
- Get all the related data from WordPress DB
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- How to check record is exist or not in WordPress CRUD Operation with $wpdb
- What’s the preferred method of writing AJAX-enabled plugins?
- How to add a shortcode button to the TinyMCE editor?
- Redesigning Custom Post Type “Add New” page
- How to stop showing admin notice after close button has been clicked
- How to save the values of checkbox to the register setting?
- Creating a default Custom Post Template that a Theme can override
- How to get Login Error messages on a custom template
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- How do I check if my $wpdb->insert() was successful?
- Claim Listing functionality – how to send email to users when their claim has been approved or denied
- Creating a theme option page?
- Add post thumbnail from external image with plugin
- Where is the source code that makes the “all” array grabs filters in the $wp_filter?
- Options page not displayed under Settings menu
- Is it possible to add an action to the currently running action?
- How to include and use custom class files in plugin?
- Action on post publish
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- unzip a folder on specific location and delete the zip file
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- Changing labels of status filters for post grid
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- Plugin version is not showing up in wordpress.org plugin directory
- Own plugin corrups plugin-activation
- wordpress plugin is not activating from widget
- uninstall.php file in Plugin to clean DB
- finding whether request is for post, and post id
- How to get specific setting by settings_fields()?
- Save / Show multi line text in metabox
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Owl Carousel2 image not displaying full width when using Stretch row and content, Stretch row and content(no padding) in wordpress
- Best way to initiate a class in a WP plugin?
- Force language in translate function
- wp_footer hook only working on homepage not in other pages
- How to create a child/addon plugin
- How to secure the release of WordPress plugins / avoid copying plugins?
- add_filter doesn’t work
- How do I combine a theme with a plugin
- Use wp-config.php constants in all files of plugin
- how to force tag page layout to use same as search layout?
- Delay JavaScript files from loading
- Run function on plugin activation before plugin is loaded
- Using ACF default value to autoincrement a number field
- a href adds default URL with the given echo URL
- Gutenberg Block Style CSS Class Is Not Applying on Backend
- Images under 1MB are not being compressed
- Sanitize $_GET variable when comparing
- Where can I save plugin data?
- How to add a WordPress Nonce for this form to avoid CSRF
- Overriding current theme files via plugin
- How to create a plugin that includes all the other plugins?
- How to add update function to plugin without adding it to https://wordpress.org/plugins/ [closed]
- Mowing site to another domain in simplest way
- WordPress custom plugin that uses woocommerce enabled payment gateway for payment [closed]
- How to call external functions from a PHP script in a WordPress plugin?
- How to edit link for comment count
- WordPress Feed Creator Name Tag Full Name Instead Of First Name
- Integrating Custom Database with WordPress
- How to add custom function to pluggable.php
- How to get Recent Post From Each Category with Thumbnail?
- How use wp_insert_post and add og:custom tags?
- Access remote SFTP server via WordPress login?
- How to change “Read More” text?
- How to use wp_editor and save its data in wp_posts table
- My WordPress activation hook isn’t working
- wpdb update method is updating but not refreshing the current page data
- Shortcode and WP query using category attributes
- Securing a plugin pop-up window
- Is admin section completely customizable in terms of styling?
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- Better way to run heavy scripts using WordPress database
- Echo custom admin field into a is_single()
- how to check plugin name unique or not?
- Exclude specifed files from plugin editor
- WordPress ajax not working in registration
- Can a developer adopt a plugin marked as “not updated in over 2 years”?
- Post curl function save twice using plugin hook function wordpress
- Getting warning of Missing argument 2 for wpdb::prepare()
- Jquery post responses 500 error after some time and lastly an 503 error
- How can I delete the options from DB when the plugin is deleted?
- Unable to pass arguments from plugin form to filter hook using ajax, the data is transferring via ajax but unable to pass as arguments in filter hooks
- How to update changes to multiple sites at the same time
- Why am I getting an error when requiring a file in my plugin?
- Allow manage_options capability for specific user only for specific plugin?