Create a database table when activating a WordPress Plugin
Harish Kumar · · 2712 Views
Utilizing custom database tables for your WordPress plugins is one of the ways that you can enormously improve the sort of plugins you can make. Database tables give you an approach to oversee, arrange, and save data for your plugin, and making them for your plugin is very easy.
You can use the following code snippet in your main plugin file. The function, which will make the necessary database tables only if they don’t already exist, will be run when the plugin is activated.
1
You may also like:
Hi, nice article but the variable name should be $your_table_name instead of $your_db_name. $your_db_name = $wpdb->prefix . 'your_db_name'; <---------
Thanks!