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
- Am I not understanding plugins?
- 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
- Looking for most performant way to execute several similar WP queries within shortcodes
- 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
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to sanitize any integer input field in wordpress?
- 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
- Font Awesome changing default WordPress Font
- Help with a $wpdb MySQL Query
- How i can obtain all the post meta for a specific post as an array?
- Download full html page with CSV export plugin
- Can’t Query Custom Table Using $wpdb Method
- $wpdb returns duplicate posts
- Update postmeta after theme switch
- Creating Database Table vs. Adding MetaData to Post & User
- Usage of call back function of add_meta_box()
- how to save checkbox data for custom setting?
- How to Schedule Cronjobs for start of every month and year
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- Way to send multiple values for column to MySQL?
- WPDB secure custom form
- How can I get plugin meta data without knowing the plugin folder?
- calling admin-ajax.php from admin-ajax.php
- Flatten Responses returned via WP REST API via WP_Error for obfuscation
- How does add_option() function enable action hooks to fire right after actiavtion?
- Create plugin with custom page and template caused an error `Call to undefined function get_header()`
- Display Results of SQL Query on WP site
- PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2
- Submit remote form to wordpress REST API and save data to custom post type
- How to display MySQL table data which is stored as an array?
- Foreach Loop Of Post Types With Nested If Else If Not Completing Process
- In a foreach loop, how can I add a meta value if it doesn’t exist?
- Looping through and combining calls to Woocommerce REST API
- Should I use wp_cache in my plugin to make it faster?
- How to access this jQuery/AJAX data in a PHP file/WordPress plugin
- post_exists stops working in a scheduled event
- register dependency css and js inside a plugin class
- When I create a new custom post type, it replaces the old post type
- How to add delete, approve, spam Links to Comments
- Inserting other fields to existing registration form in a WordPress theme
- Advanced WordPress SQL Query
- Site doesnt work once PHP changed to 7.1
- Setting at job with shortcode not working
- Run code before WordPress loads and insert data into WP if need be
- How to detect if a revision was made by woocommerce or wordpress?
- can’t delete a row from post_meta table
- PHP: Why does my code work in index.php but not a widget?
- retrieve wordpress post-meta using php not wordpress functions
- Accessing Variables Used In a Plugin Using PHPStorm + XDebug
- Splash pages on a high traffic site
- how to search through plugin in wordpress cimy-user-extra-fields?
- I’m not able to get access $wpdb in my php file in wordpress
- Submit cf7 form to cfdb as pdf/BLOB [closed]
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- Custom taxonomy with page post type – WordPress
- Query posts by custom taxonomy slug in WP REST API?
- oneOf JSON Schema validation not properly working for custom post meta value?
- Too few arguments at registering new templates in my plugin
- running an existing WordPress site from Visual Studio Code?