I solved this issue. Problem was in way I was using register_activation_hook.
I loaded TbybInstall along with other classes:
/*
* Load classes
*/
require plugin_dir_path( __FILE__ ) . 'classes/class.PreparedCarts.php';
require plugin_dir_path( __FILE__ ) . 'classes/class.ReturnOptions.php';
require plugin_dir_path( __FILE__ ) . 'classes/class.TbybInstall.php';
…and I used register_activation_hook in a way which is more similar to official WordPress guide:
/* Create database table on plugin install */
function create_tables(){
TbybInstall::create_tbyb_prepared_carts_table();
}
register_activation_hook( __FILE__, 'create_tables' );
And that’s it.
Related Posts:
- How to use update and delete query in wordpress
- How to make WordPress plugin check for database changes and then do something?
- simple wordpress ajax plugin not working when not logged in
- WordPress Ajax Custom Query – High CPU LOAD
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- Update results, Before deleting the related category [closed]
- wp query foreach deleting record returning only first or last item
- Custom array from a query only write the last row of the query
- wpdb prepare insert table doesn’t work
- WordPress WP_Query without query GET parameters
- select a single val though a table in wordpress
- How to import woocommerce custom fields data into another site?
- Need help with format of nested array in MySQL
- Send data from plugin to external database
- MySQL update text field with ‘
- How to edit the default database of WordPress [closed]
- Fatal error: Call to undefined function mysql_connect()
- the_date() not working
- How to return number of found rows from SELECT query
- Fatal error: Call to undefined function plugin_dir_path()
- How to use copy() function and paste file in /wp-content/themes directory
- wordpress custom endpoint multiple params
- Successful or Error Message after running mysql code in functions.php
- PHP/MySQL issues when running WP on EC2 cloud [closed]
- WordPress get pagination on wpdb get_results
- How to create another version of my site based on the same database
- Page Reloads Before AJAX Request Finishes
- Add htaccess rules with insert_with_markers at beginning of htaccess
- Insert array data on plugin activation
- Stumped on migration
- PHP code inside shortcodes
- Is XAMPP faster than running LAMP in WSL on Windows 10? [closed]
- Adding Default Settings to Theme My Login plugin
- WordPress Site Running Extremely Slow on Dedicated Server
- Get updated query results on page after insert in database
- WordPress not reflecting changed of the database
- Hide categories that are not used in the post type
- WordPress ajax doesn’t display object method on jQuery .change() function
- filter default query to show just selected level of child pages in wordpress
- How to make my custom widget appear within WordPress widgets? Plugin development
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- Refresh table data with Ajax
- Database query works fine outside WordPress
- Using custom tables for old posts
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- Asynchronous multiple requests 401 Unauthorized
- Multiple meta_key in one global $wpdb;
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- Using data sent via AJAX in multiple functions on a WP plugin
- What does -> mean in WordPress?
- Location of core code for database connection and get_header
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Change product_base programmatically
- How to add the sidebar to all the pages except the home page? [closed]
- Plugin development and composer
- Hide posts if user is added to it WP_query
- How to unserialize data from MySQL
- Set default Database Storage Engine when creating tables with plugins?
- custom post type with role Vendor
- Get the id of the row from database on click of a button [closed]
- Execute Jquery when a specific page in my plugin is loading
- SQL error with custom query
- Modify WooCommerce used to get all orders in dashboard
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- WordPress can’t use ZipArchive
- Only the first image uploads
- WordPress loading progess – wp-blog-header.php
- Custom plugin: how do I call a PHP file if settings option is set to true?
- Inside Array – “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress [closed]
- Trying to use a variable to set image width
- wp_update_post gives 500 internal error
- WordPress Bad Request Error 400
- I am facing this error Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- How to identify which php file a plugin is using on page load?
- dashboard widget form not submit mails
- What is the correct way to search 3 custom fields only in WordPress?
- register_setting not save checkbox
- cant insert data in a custom table in phpmyadmin
- How does one make a URL return dynamic JSON with custom Content Type?
- autocomplete in wordpress using ajax with json-data
- Add .php to end of all WordPress Pages (multisite)
- Getting Member Data From WhishList Member on Register
- I’m writing my first plugin and my echo output is showing up on every page of my wordpress installation
- global $post inside plugin query messes up every new post page in wp-admin
- wp_query (or hook) posts by date (id) in array then set post_type
- Chosen Select jquery Not Working in Plugin
- MySQL queries in WordPress
- Let users register weight each day and save it in DB
- Create and update Custom Cookie based on multiple GET and POST Values for first time visitors?
- Can’t remove menu items added by plugin
- Issues separating my Plugin pages into different files
- How to hide Ads From Certain Categories?
- Displaying custom meta box value in a custom post page
- how to check elementor is widget is active or loaded
- Create a custom plugin with dynamic child pages listing database records
- Global update of records after import WP All Import Pro
- Cannot Access ACF Field Values via my Plugin