You can use wpdb insert function. It’s better in every way.
It can care about data’s escapeing itself and it’s shorter.
You can use your own query anyway but I would recommended this article for reading https://codex.wordpress.org/Data_Validation#Database
Related Posts:
- Who is responsible for data sanitization in WordPress development?
- What’s the proper way to sanitize checkbox value sent to the database
- What is the most secure way to store post meta data in WP?
- Default WordPress settings API data sanitization
- How to display data from custom table in wordpress database?
- Using two different DB users on one WP install
- Is $wpdb->prepare escaping to much? How to use it properly?
- How does WordPress store data?
- How do I properly update the WordPress database password?
- What is the proper way to validate and sanitize JSON response from REST API?
- data (html) migration to posts
- WordPress and user security
- What can I do when an outside party hacks into my weblog and changes my display name?
- WordPress security [closed]
- Safely store code(html/js..) into database
- Secure way to use name_save_pre?
- WordPress Database – wp_usermeta and the correct number of session_tokens rows
- Insert NULL value using prepare()
- Where is the HTML-handler part in the wpdb class?
- spambot registering without providing email or password, bypassing registration process
- Hash user emails in database?
- MySQL SELECT increment counter
- Exclude Statement in SQL
- Custom form that store input in database
- How to use “TRUNCATE TABLE” MySQL statement?
- delete_option() and update_option() returning false
- How to change option recently_edited?
- Export wordpress table to excel
- When importing database, it shows error
- How to close wpdb connection? [duplicate]
- Meta query interfering with orderby relevance
- save new data to wp_options non-post form
- Error establishing a database connection when migrating site to localhost
- Strange Deadlock database error for the query “Delete From wp_options”
- Strange characters on wordpress site – Not UTF8 Issue
- WordPress showing install screen after max_questions error
- Connect to live db whilst working locally
- PHP variable in WordPress database query
- Differences between add_post_meta and update_post_meta
- Why do wordpress store pages/posts within the database instead of files? [closed]
- Insert custom data to custom table on wordpress database
- Query WordPress database by registered date and role
- Merging WordPress posts from different databases
- How to replace values in WordPress DB using phpMyAdmin
- Select Multiple meta_value from WP DB; Single Query
- Is it possible to split database tables using HyperDB?
- Show content from database
- Customize JSON output
- How do I get WordPress login to ignore the password input if a particular username is used?
- Migrating WordPress from DreamHost to Azure WordPress Resource via UpdraftPlus “wp_options table does not exist…” error
- “Error establishing a database” connection on some sites
- Is it necessary to sanitize wp_set_password user input?
- change wp user status from wp_users table
- WordPress is not creating table in database after activating plugin,
- Is MariaDB’s Aria storage engine suitable for WordPress?
- Difficulty importing my live site to local
- How do I delete these post types in my WordPress database?
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- How do I query wp_options for expired transient pairs with MySQL commands?
- WordPress running SQL query to update database from form
- How to fix database error duplicate entry
- WPDB SQL query with prepare() returning variable, not db value
- Get value form wordpress database
- Why this query is not showing any result on wordpresss home page?
- How to migrate a database from a server to another
- How to display content from external db with relevant urls
- Is there an easy way of exporting posts with their category already asigned and pictures from localhost?
- Connect to another WP install and grab post based on custom field
- how to count click tab menu and insert to database
- Adding prefix to WordPress database tables breaks admin capabilities?
- What is the best way to resurrect and update my old WordPress site?
- content disappearing minutes after it’s published
- What is the most efficient way to reset a WordPress site?
- Add pdf to a website
- Optimizing function that automatically creates internal links based on post title string
- Help With a Large WordPress Based MySQL Database on Shared Hosting
- WordPress where clauses in db select
- Can two domains use the same database?
- _wp_attachment_metadata is not being added to database when PDF files uploaded
- adding user_id and name to a separate table whenever a user register based on role
- How do I loop/iterate through posts to edit all img tags?
- User saved through WordPress backend does not show up in database table users
- How to edit posts/pages without making the change live?
- How to optimise this database query?
- How to retrieve user data based on role using SQL?
- Adding featured for post using database
- Does WordPress Support Using Named Pipes on the Windows Operating System?
- get_the_terms is not working
- Store id from database query in cookie
- Split database on large site?
- Store the wordpress “featured image” under »wp_posts« Database table
- Return image urls with specific base string?
- What WordPress file is saving new users to database
- wordpress database error
- How do i get value from wp_postmeta?
- Link to handle $_GET request
- WordPress sync with phpbb
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- SQL query to rewrite all media URLs to end with .webp
- Many images in wp-content/uploads folder that are not in Media Library