You can add above code on plugin activation hook so that code run whenever you activate plugin.
For checkbox You need to define table column type as Boolean.
Dont forget to check table is already exist or not. otherwise it show error on second activation.
Related Posts:
- Delete tables from database when deleting plugin
- Can I upgrade a plugin to a specific version?
- Get plugin_dir_url() from one level deep within plugin
- How to have WordPress send a user confirmation/validation email on signup
- Filter out results from REST API
- How do I disable a plugin enforced by my host (in mu-plugins)?
- Do Plugins effect site loading time?
- How to place random widgets in the WordPress sidebar?
- Auto login using Active Directory and Windows Authentication
- Should I use RIPS tool to test my themes and plugins?
- Plugin search sorting for admin section – WordPress [duplicate]
- How to disable autocomplete for inputs in contact form 7? [closed]
- Determining where fopen() is writing files when used from WordPress AJAX call [closed]
- Adding “ ” before the last word in multiple defined areas with a plugin
- Plugin Functionality Only for Editor and Administrator
- Plugin to hide admin menu (vertical menu bar)
- problem with nextgen plugin
- Creating Custom Roles for use on a WordPress Multi-site Instance?
- Building WordPress Plugin Using FPDF – How do you get post content from currently viewed post?
- Storing Email Account Passwords for SMTP Mailing for a WordPress Plugin
- Do you clean up your self-written plugins’ at deactivation?
- PHP Fatal error: Call to undefined function plugin_basename
- Restored WordPress on new Server – Can’t auto-update plugins
- How many SQL queries WP Super Cache make to serve cached page?
- omit / remove ” from category list
- Is any information available in PHP files in WP about plugin activation history?
- Download any file after submitting a form [closed]
- Call to undefined function get_userdata in user.php
- Use flash on a wordpress site as a widget
- (Sticky Row) How do i make a row sticky in wpbakery page builder?
- Submit form after reCaptcha is solved
- how to create progress bar in wordpress contact form 7 or other plugin for set progress bar in cf7 [closed]
- remove_section in a plugin
- How to export all content with feature images?
- Cron Job not working in plugin
- this jQuery function works perfect in static html page but not on wordpress
- Sidebar widget: Randomly select text from a given set
- Run a plugin just ‘once’ per page reload
- Create custom pages with a plugin
- Is it possible for a plugin to force reading and writing of uploaded images to a database instead of to a filesystem?
- $wpdb update query in plugin only updating one column
- WordPress as template engine
- Cropping images from top center using Jetpack Photon
- XML Sitemap Generator can’t notify google and bing
- How to limit image size for the entire website ? But without editing the post (css/plugin?!)
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- Minimize and Uglify WordPress Plugin Files
- How to request admin-ajax.php correctly when wordpress URL and site URL are different?
- Use jQuery Datepicker code from plugin
- Installed Forca Theme, wonder how I can alter Post editing screen
- How to Use the Filter “sidebar_login_widget_form_args”
- How to include wp-postviews plugin directly in the theme
- How can i listing current category and Featured Category post list?
- Contact Form 7: Load scripts and styles only when there is shortcode? [closed]
- How to theme code blocks formatted by the prettify.js embedded with WP-Markdown?
- Is there a syntax highlighting plugin for HTML View? [duplicate]
- admin-ajax.php 500 error when new users try to register
- Hide plugins and theme from public
- Same Plugin tables between wordpress installations
- How would I get the new plugin version on this function?
- acf backend error handling
- How to get the custom field value using SQL query
- Javascript not getting injected into page
- Changing wordpress/woocommerce notices default message to other languages (text)
- Why does my custom plugin only function correctly once per page?
- Homepage to serve the content of page created from a plugin [duplicate]
- wordpress loop giving me content
- How to get checkbox by default true in metabox?
- Submenu Page under Settings in Admin Panel
- Custom plugin settings page with tab. Error: “Sorry, you are not allowed to access this page.”
- I can’t view the orders on the woocomerce dashboard with the brainblocks plugin
- return bbp_get_topic_author_id as integer
- Which membership plugin enables users to enter html links in blogs and on their profile page?
- How to add a box note in wordpress plugin page ? top header side.
- Help needed with woocommerce (wc stripe) filter
- WordPress Widget: Is it possible to make the form dynamic without updating?
- How to create a custom page for unrelated database?
- Custom on the fly e-mail alerts
- How set role at registration based on email?
- Site is continuously accessing by several IPs
- WordPress function to add text
- Directory structure for plugin changes
- How can I pass value to function in add_menu_page?
- Why did a WordPress plugin vanish from the WordPress repository?
- Moving to WordPress Premium versus a hosting provider
- TheCartPress plugin – Make every item in store unique
- How to find an option in the database?
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- woocommerce_payment_complete hook only called after accepting payment?
- how to sort results by last day update at search result in plugin installer?
- My AJAX API plugin isn’t working
- Want to add post to user dashboard
- How to hide a piece of code from a wordpress web page?
- Make a magic tag work with Custom Post Types
- Bidding site plugin [closed]
- Editing a theme
- woocommerce create subscription for user using functions / hooks provided
- How can I wordpress cache a database request with no existing plugin?
- Save Confirmation Page Title to WPForms Entry
- Problem on a wordpress website with a plugin [closed]