Yes, WordPress will sanitise data on its way to the database, so long as you use the APIs.
If you’re using the wpdb
object however you’ll need to use the prepare
method to sanitise. I recommend against writing SQL queries as it bypasses object caches etc, but if you must write your own SQL, use wpdb
to prepare and execute it
For calls such as WP_Query
, get_posts
, add_post_meta
etc etc sanitisation occurs
Note that this is purely DB sanitisation, any additional sanitisation or validation you require, such as trimming trailing spaces, validation of URLs, stripping tags, escaping, etc, must all be done in your code
Related Posts:
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- Is sanitize_text_field() is enough to save to DB?
- What is the proper way to validate and sanitize JSON response from REST API?
- What’s the proper way to sanitize checkbox value sent to the database
- Safely store code(html/js..) into database
- MySQL Database User: Which Privileges are needed?
- Database synchronization between dev/staging and production
- How can I make updates to a site, on a development copy, but then move updates back without overriding live site’s evolving database?
- Safest way to bulk delete post revisions
- How can I make a WordPress database portable and url independent?
- How to properly validate data from $_GET or $_REQUEST using WordPress functions?
- is_email() VS sanitize_email()
- Why does $wpdb return strings for mysql integer values?
- Dealing with Many Meta Values, 30+
- When is it appropriate to create a new table in the WordPress database?
- Is it possible to switch the data layer within WordPress?
- What is the most secure way to store post meta data in WP?
- store simple data in get_option()
- Default WordPress settings API data sanitization
- How to delete outdated, wrongly sized images in _wp_attachment_metadata?
- Have multiple local wordpress installs share a wp-content folder and database
- How to display data from custom table in wordpress database?
- How to implement content from external database into WordPress text page? [closed]
- Cloning and syncing a WordPress website
- What actions affect files, DB, or both?
- Using two different DB users on one WP install
- Add search Value to wp_list_table pagination
- Is $wpdb->prepare escaping to much? How to use it properly?
- How does WordPress store data?
- How to fix unchanged URLs in Database after running serialized search and replace script?
- Merging WordPress posts from different databases
- Should non-WordPress data get its own DB?
- vs WordPress Security
- How do I properly update the WordPress database password?
- Search and replace special characters (å,ä,ö) for image attachments only in database
- Permit Login if table row exists
- data (html) migration to posts
- Localhost to Staging to Development Dynamic WP-CONFIG
- Setup 3 Sites To Connect To 1 Database and Share Data
- Unable to sanitize in customizer and escape in theme without removing ability for user to use “< br >” to insert a line break
- WordPress and user security
- Uknown meta entries in wp_postmeta
- Is it necessary to do validation again when retrieving data from database?
- What can I do when an outside party hacks into my weblog and changes my display name?
- creating new field on mysql
- Why user_pass column in wp_users table is varchar(64)
- Using $wpdb | checking entered email against existing emails in db
- Can local WordPress installs share /wp-content/ folder and database?
- How WordPress sanitizes post content on save? Or it doesn’t?
- WordPress security [closed]
- SymmetricDS in dev + prod workflow?
- 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?
- A WP dev site that displays content from a live site’s database but cannot write to wp_posts?
- WPCLI search and replace in a particlar site dir effect another site-dir
- Merging development site with live site
- spambot registering without providing email or password, bypassing registration process
- One WP Database outside localhost and two connections
- Hash user emails in database?
- Get id from database
- Share WordPress Database
- MySQL Database User: Which Privileges are needed?
- how to sanitizing $_POST with the correct way?
- Disable Database Update Required ? break my website
- How to transfer from localHost to live but use the already existing database on the server?
- Files on Localhost, Database on Server
- Brandoo WordPress Unable to Update to WordPress 4.2.2
- Connecting to wordpress database in my application [closed]
- WordPress as a frontend website for iOS app [closed]
- Website displays old version of page
- Woocommerce – Check product stock availability from external database
- Backing up WordPress database and files
- Create Pages for database content
- Get results from wordpress data custom table
- Is it risky if I update all url in the database due to my site url changed?
- Should I use an additional column in the DB?
- No users table in WordPress’s database
- Outputting query results
- Help With a Large WordPress Based MySQL Database on Shared Hosting
- Storing user submitted forms [closed]
- User Tracking for Custom Post Type “Lesson”. Database Queries and Performance
- How to split the WordPress database?
- $wpdb->get_var – What value is returned when zero records are found?
- Understanding WordPress Search
- Remote database -> massive response time increase?
- Custom Post Type not showing anything added by code anymore?
- WordPress where clauses in db select
- Image link issues after importing a database backup to my local web server
- multiple wordpress installs w/shared user database but separate content databases
- How to display data from db in select list [closed]
- access JSON results from wordpress database with wpdb
- How long is “as long as possible” in wp_cache_set()?
- wp_option table error while importing
- How to add checkbox with multiple values in table?
- wp_insert_user not creating account correctly when ID is manually set
- Installing local to live WP into subdirectory
- A change in URL slug in database returns 404, how can I do auto-redirect?
- WordPress SQL – How to Check for Category?