In the question you linked to, the solution was to use mysqli_multi_query
as the API for executing the SQL. $wpdb desen’t have an API to do a multi query therefor you can’t use it directly, but you can get the handle to the mysql interface from $wpdb->dbh
and do something like
$sql_trigger = "....";
mysqli_multi_query($wpdb->dbh,$sql_trigger);
Related Posts:
- How do you properly prepare a %LIKE% SQL statement?
- wpdb->prepare function remove single quote for %s in SQL statment
- Alternative to mysql_real_escape_string
- Increment value (value = value+1) of $wpdb->update
- wpdb Custom Meta Data with 2 conditions
- wpdb prepare syntax
- SQL query not working in alphabetical post title/content search
- MySQL LIKE not working
- Proper way to work with wpdb to get user’s firstname
- How to check for empty and not a failure
- Database: Custom table: sprintf value for DateTime column
- Converting mysql to $wpdb
- WP_USE_EXT_MYSQL
- wpdb insert and boolean fields
- Join new table with SQL query
- writing inner join in wpdb
- How to split the a table in database?
- MySQL Rank & $wpdb
- When WordPress Default table, Echo Success. When Plugin Table, Echo Blank
- How do I join a $wpdb query with user meta using default value if not exist?
- How to translate this mySQL query to $wpdb query
- $wpdb select all meta for each post
- $wpdb to insert html form information
- Proper usage of $wpdb->update()?
- WordPress(wpdb class) and mysql stored procedures
- Can’t run database query
- Using WPDB->Insert()
- Active DB queries in WordPress?
- How to stop $wpdb from prepending database name
- WordPress $wpdb get posts from category and sort by custom meta
- How to get INSERT errors from $wpdb?
- Getting Error Trying to Create Table
- How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option
- Understanding custom php that reads from WP MYSQL
- How to insert dash (-) into database using wpdb and new_to_publish hook?
- $wpdb->get_var multiple queries in one database check
- List users with the most posts in the last 30 days
- Insert two row in wordpress database
- WordPress $wpdb no result
- PHP variables in mysql query
- MySQL ‘duplicate entry’ error
- User set date and time from frontend doesn’t get stored into database
- Wpdb query with dynamic table name
- get posts whether meta_key exists or not
- when using $wpdb sudden connection rejection without changing anything. Access denied, with errors from repair tool
- How to search usermeta table
- How to add virtual column in wpdb get_result statement
- wpdb insert into point column in db
- WPDB delivers wrong results from complex queries
- $wpdb post type and term query only works when there are no dashes or spaces in the term slug and title
- CONCAT_WS in custom sql query
- Geographical proximity query using post_meta
- MySQL Select within WP Page template
- Saving custom term value to the database in new table
- why is $wpdb->update() causing a DB error from within wp_set_password()
- $wpdb->get_var returns 0
- Initialization of table in database using ‘CREATE … IF NOT EXISTS’
- MySQL Error “Operand should contain 1 column”
- MySQL server startup error ‘The server quit without updating PID file’
- Duplicating a MySQL table, indices, and data
- MySQL IF NOT NULL, then display 1, else display 0
- Get the new record primary key ID from MySQL insert query?
- How to change collation of database, table, column?
- ERROR 1115 (42000): Unknown character set: ‘utf8mb4’
- Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
- Remove Primary Key in MySQL
- How to get the max of two values in MySQL?
- Error: Duplicate entry ‘0’ for key ‘PRIMARY’
- Using wpdb to connect to a separate database
- Why are simple updates to wp_postmeta’s “_edit_lock” so slow?
- How to log mysql errors from wordpress core?
- Fulltext search in posts sorted by relevancy
- How can I SQL update a meta_value to remove the dollar signs that were entered with the value? (so just the value remains)
- How to bulk delete all WordPress subscribers?
- Changing Table Prefix for an Existing WordPresss Site
- Set meta_key and meta_value for all registered user in wordpress using sql query [closed]
- Connect another DB and fetch records from some tables
- Can I restart MySQL engine when WordPress website is live?
- Why my wordpress loopback traffic while socket is setup?
- wpdb custom tables without plugin
- Update or insert meta key value – On Duplicate key update
- Connect to MySQL using Windows Authentication
- Have working sql query… trying to adjust it to use $wpdb
- Export Yoast Keywords from MySQL/phpMyAdmin
- Same database; different WordPress
- How do I prepare strings for insertions as values into a MySQL table?
- Why won’t this wpdb get_results query return results?
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- WordPress & MySQL , problem with use many array in meta_query
- Using wpdb to connect to a different database is not working
- WordPress Dutch characters encoding problem
- Why can’t i come back to older working version of php after ugrade with error log on php 7.2 and 7.3
- How do I insert content of various MySQL fields in post?
- Select latest 2 articles, but only from given category
- Query does not filter duplicate _sku numbers
- wp_postmeta – lot of meta fields
- MySQL database migration to WordPress
- MySQL: get post_tag items that are tags (not SEO keywords)
- cannot log in to the mysql server (wamp and wordpress)
- SQL command to export post_content from wp_posts using phpMyAdmin