Consider trying with $wpdb->insert()
method instead of raw query. Using of functions/methods is recommended for interacting with database over raw requests, unless absolutely impossible.
Related Posts:
- Get multiple custom field values in a $wpdb query [duplicate]
- Help setting up a sql query
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- So much data in postmeta
- What is the advantage of the wp_options design pattern?
- importing data from non-wordpress mysql db
- Query meta field using between
- Move value of one custom field to another
- How to filter a dd/mm/yyyy date from a custom field in a query
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- little help with a mySQL query to wp database
- Importing users to Buddypress with custom fields
- MySQL query to set wp_postmeta using term_taxonomy_id value
- MySQL Query that looks for post with Custom Field, then changes Category
- Unique Post Meta Values
- Add custom field to all posts in specific post_type
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Custom Query based on custom field of a single post
- Build index page from custom fields
- Importing WordPress Posts With Custom Meta Data As CSV Files Through PHPMyAdmin
- Inserting data into MagicFields using mysql queries
- Copy price categories to custom field
- If I update WordPress my custom data will be deleted from the wp_users table?
- Get emails from users by custom field SQL
- Update post meta data (custom field) by post link
- How to improve my non-unique metadata MySQL entries?
- What is the correct way to search 3 custom fields only in WordPress?
- Delete a custom field in mysql for all posts with specific category id
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- use mysql to replace one custom field value with another custom field value
- Update custom table on metabox POST
- ACF plugin and field update
- Query postmeta values, and return multiple post_titles for common meta value
- Query Custom Fields in Searchform
- Copy url from post_content to custom field
- Convert many posts from having a specific meta_key to use a post_format
- Custom Search, MySql Query Gone Wrong?
- Site uses wpdb to fetch meta_keys but just displays first meta_key from a page (the post uses the same meta_key “filmmaker” more than once)
- Can running a WP-Cron to update_post_meta cause performance issues?
- Best way to programmatically remove a category/term from a post
- Add new “Insert Into Post” button with another function
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- Search multiple meta keys at once
- How to add new custom page or post blocks?
- Transients vs CRON +Custom Fields: Caching Data Per Post
- How to update serialized data in the user meta data
- Best way to allow manageable social media URLS?
- Adding a custom field or metabox to the post-thumbnail widget?
- Using $wpdb Class to Pull Recent Comments Across a Network
- Using WP Query to search by multiple meta fields
- Get aggregate list of all custom fields for entire blog
- Sort by posts that have a featured image?
- WP_Query display next custom post from today’s date
- Can ordering post list by meta_value cause performance issue?
- woocommerce product custom field
- Converting MYSQL to WordPress $WPDB
- two custom fields question
- How to save multiple options from a dropdown in user profile
- How to display multiple images in custom field
- How to split the a table in database?
- Display the contents of a custom field of a page on their child
- Read / Watch / Listen times – meta
- Login WP – Connect single field to an external api
- adding extra wordpress user info from registration form
- Turn raw url into clickable links
- Advanced Custom Fields functionality without plugin
- Get post ids sorted by meta_key
- Advanced Custom Fields Plugin – Unable to get URL from post_object
- Unable to get specific value from post meta
- 3.8 Media Upload and Custom Meta Box
- Displaying Custom Field Array
- Let’s Create Custom Field Template Documentation
- WordPress Settings API Repeatable fields
- Basic wpdb update question
- Accessing Custom Fields on Pages
- Display a different image for each page with editor
- WP_query multiple custom fields not working
- Help with Related Posts Function
- Custom Field Date Problem
- Approach to creating a site with this structure
- how to create meta key name in wp_usermeta table in database
- Display the output from Custom User Fields from a WordPress user profile on a WordPress Custom Page
- MySQL ‘duplicate entry’ error
- What is my error trying to create a new table in the database?
- Show image depending on the number in the custom fields
- Save, update, get and sanitize post meta as HTML not plain
- How can I get $wpdb to show MySQL warnings?
- MySQL Select within WP Page template
- Term specific featured post on taxonomy archive pages
- Saving metadata of related post on save_post
- Query Distinct Taxonomies of Custom Post Type
- Custom field value link title
- How to Order Posts by Custom Fields?
- added a meta box to post however when saving menu while debug on throws a warning
- How can i get the actor birthday by date?
- Advanced Custom Fields for Header that are Editable from a Page [closed]
- Order by a meta field in query loop
- Multiple triggers when publishing, saving or updating a post in WordPress
- If possible a field ID transfom in a Custom Field?