WordPress 7.2 changes how its database connection handles MySQL’s NO_BACKSLASH_ESCAPES mode. The change affects the WordPress connection’s session, not the server’s global settings. Most sites should see no difference, but hosts need to know why the mode is removed and what to do when a site requires it.
In brief: WordPress uses backslashes to escape special characters in SQL. When MySQL has NO_BACKSLASH_ESCAPES enabled, it treats those backslashes as ordinary characters, which can cause queries with escaped values to fail or return incorrect data. WordPress 7.2 removes the mode when it connects, limiting the change to its own database session.
The change was detailed in a WordPress Core dev note published October 9, 2026. For hosting teams, the key distinction is scope: WordPress adjusts its connection rather than changing a MySQL server’s configuration.
What NO_BACKSLASH_ESCAPES WordPress 7.2 changes
WordPress 7.2 adds NO_BACKSLASH_ESCAPES to the SQL modes that WordPress does not support. When WordPress connects to the database, wpdb::set_sql_mode() removes the mode from the session’s SQL modes. WordPress already turns off other modes when connecting, including STRICT_ALL_TABLES, TRADITIONAL and ANSI.
| Area | What changes |
|---|---|
| WordPress database connection | The session no longer uses NO_BACKSLASH_ESCAPES by default. |
| MySQL server global settings | WordPress does not change them. |
| Most sites | The Core team expects no noticeable difference. |
This is a compatibility adjustment for WordPress’s own SQL behavior. It does not amount to a general instruction for hosts to disable the mode across their MySQL servers. A host can keep its server configuration as it is and understand that WordPress 7.2 will handle the mode on its connection.
Why WordPress removes the SQL mode
WordPress uses the backslash character to escape special characters in SQL queries. With NO_BACKSLASH_ESCAPES enabled, MySQL reads a backslash as a regular character instead of an escape character. As a result, queries containing escaped values can fail or return the wrong data.
Some hosts or server setups enable the mode. Before this change, a site on one of those setups could develop database problems that were difficult to diagnose. The dev note identifies this mismatch between WordPress’s query handling and MySQL’s interpretation as the reason for the change.
For hosts, this makes the WordPress-side behavior more predictable on systems where the mode is enabled. It does not mean every site had a problem, or that every database server needs a configuration change. Most sites are expected to carry on without a visible difference.
What hosting teams should tell site owners
Keep the scope clear when documenting or answering support questions: WordPress 7.2 changes its own database session, not a host’s server-wide SQL mode. If a site owner asks whether the update changes MySQL for other applications or connections, the answer from the dev note is no.
Hosts should also avoid treating the change as a reason to add custom configuration across all customer sites. The default is intended to address compatibility with WordPress’s SQL escaping. If a customer says their site needs the mode, first establish that there is a specific requirement before applying the opt-out described below.
The change is tracked in WordPress Core ticket #66185. The Core team also cautions that WordPress itself may not work correctly if the mode is kept enabled, so opting out should be a deliberate compatibility decision rather than a routine hosting setting.
How a site can keep the mode enabled
A site that really needs NO_BACKSLASH_ESCAPES can use the existing incompatible_sql_modes filter to remove the mode from the list WordPress disables:
add_filter( 'incompatible_sql_modes', function ( $modes ) {
return array_diff( $modes, array( 'NO_BACKSLASH_ESCAPES' ) );
} );
That code belongs in a db.php drop-in. WordPress connects to the database before it loads plugins, so a normal plugin or a must-use plugin runs too late to set this filter for the connection.
Because the Core team warns that WordPress may not work correctly with the mode enabled, site owners should confirm they have a real need before using the drop-in. If you manage hosting, make sure support staff know both the session-level default and the early load timing of db.php.
FAQ
Does WordPress 7.2 change MySQL’s global SQL mode?
No. WordPress removes NO_BACKSLASH_ESCAPES from the session SQL modes for its own database connection. The change does not update the server’s global settings.
Will most WordPress sites notice this change?
The Core dev note says most sites will not notice a difference. The change addresses cases where the mode could conflict with WordPress’s use of backslashes in SQL queries.
Can I use a plugin to keep the mode enabled?
No. Plugins and must-use plugins load after WordPress connects to the database, so the filter runs too late. The documented location is a db.php drop-in, and WordPress may not work correctly with the mode enabled.
For your next support review, confirm that hosting documentation distinguishes WordPress’s database session from the MySQL server’s global settings, and direct any genuine opt-out requirement to a reviewed db.php drop-in.