You can’t insert multiple rows via wpdb’s insert
, you have to do it with raw SQL:
INSERT into $meta_table (post_id, meta_key, meta_value)
VALUES
('val1', 'val2', 'val3'),
('otherval1', 'otherval2', 'otherval3')
However-
You should always use the API where a function exists- use add_post_meta
so your plugin integrates with the WordPress environment and its behavior can be modified without having to edit the plugin’s files directly.
Related Posts:
- Comparisson between date() and a date from wp_postmeta
- any word search WordPress
- How to securely controlling data without keeping it in postmeta?
- Performance considerations – postmeta table versus new table for custom posts with foreign keys?
- How to fix slow comment query?
- Action hook “wp_insert_post” works but not for last imported post
- WP JSON REST API (Ryan McCue) how to query posts with specific meta data with ‘AND’ relation?
- Creating two database tables via plugin
- Query Posts by Custom Field ‘Price’
- insert data in database table from plugin with WP3.1
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- ob_end_flush error when using wpdb in plugin
- Thumb rating for wordpress – top user
- Show the “ratingValue” and “ratingCount” values of KK Star Ratings Plugin
- How to extract images of post and pages excluding header and logo image in wordpress?
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- Fatal error: Uncaught Error: Call to undefined function get_userdata()
- Set attached to state
- How use %like% in sql statement wordpress
- WordPress logo upload option in theme panel
- Inserting large amounts of data into a custom table during plugin install
- FacetWP group listings by custom field [closed]
- Where to hook my plugin’s action
- Is there a filter for get_post_custom()?
- how do i remove posts from a WP_Query so the pagination is right?
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Accessing post’s meta data based on user’s click of a post
- Get posts from WP_Query and format them on admin_head
- Doubt using $wpbd->get_col for a single column
- How to query the custom fields by language?
- Access WordPress database outside of WordPress
- Create digital-virtual-downloadable WooCommerce products from the frontend using Gravity Forms? [closed]
- switched from query_posts to WP_query, not working now?
- Problem with creating tables for Plugin
- How to display the “ratingValue” and “ratingCount” values generated by the KK Star Ratings plugin into my page’s recipe ld+json schema
- How to change this WP_Query to get all ProductIDs and not only specific one?
- Change commission_status paid when withdraw_status vendor is completed
- How to call WordPress function other files
- Insert content of a post into another
- WP_Query and NULL meta keys
- $wpdb->get_row returns column name instead of column value
- how to use in custom single.php template using php?
- How can I change the meta_key for a particular piece of information?
- Create a table with wordpress plugin boilerplate
- WordPress page and plugin list using sql query
- Using AJAX to generate front end / viewer end pages
- plugin code is pulling information from database in one instance and not in other. What is wrong?
- WooCommerce search products between price range using WP_Query
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- Meta box losing its value when scheduled post is published
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- Cannot get wpdb data (Error in a simple fuction) [closed]
- WPDB: Update table
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- Error in pdf generating plugin using FPDF
- How to remove bulk actions from custom post type
- Return multiple values in a shortcode attribute
- How to select a paragraph other than the 1st to be the post’s excerpt?
- Loop returns the current page’s permalink and guid instead of the post in the loop
- How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?
- BuddyPress activity on edit post for a CPT
- Displaying data from another database
- Using $wpdb in a plugin, what sort of data does it return?
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- Link Posts to External URL
- How to find the WordPress Nextgen galleries which are not used in WordPress posts?
- Adding CASE in WP_Query
- Need help creating asynchronous data scraper in WordPress
- Woo-commerce Update price as a Bulk from My offline software export
- Trying to get property ‘ID’ of non-object in /wp-includes/class-wp-query.php on line 4044
- ob_end_flush(): failed to send buffer of zlib output compression (0) in external php
- Help to Create a Simple Plugin to make a post
- how to display recent post by category on home page
- How to Join wp_posts & wp_postmeta table using custom query
- What database state changes happen after a post is manually “updated” with no changes?
- $wpdb->delete not working for me
- Warning: call_user_func_array() problem can anyone help with it?
- Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /../plugins/rm-payment.php
- “Enable Media Replace” plugin does not update serialized object in WPMeta
- No result after wpdb->insert
- How to get post that has non zero or greater than zero meta value
- How to insert variable which contain array value in wp_options table?
- Trending Tags based on post views
- Plugin does not create a custom table upon activation
- Proper way to trigger a MySQL query via link in a plugin
- get_var result empty for query of custom table in plugin admin
- Storing values in Post Meta vs new tables
- WordPress filter function using query modifications
- WP-Snap too slow (caused by WP_Query?)
- WordPress Meta Query: Relation is not working correctly
- WordPress ultra slow if I click on posts?
- Insert data in custom table during new post creation
- Checking url from plugin [duplicate]
- Making plugin to use different table prefix cause permission problem
- Is it safe to increase/alter the size of the wp_post.guid column from VARCHAR(255) to VARCHAR(2048)?
- Output plugin post like system count [closed]
- $wpdb selects wrong database
- FATAL ERROR: WP complains about redeclaration [closed]
- Update post meta Rest Api
- how to add meta for order in woocommerce