Title: TiDB Compatibility
Author: xuliwen
Published: <strong>March 6, 2024</strong>
Last modified: November 2, 2026

---

Search plugins

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://ps.w.org/tidb-compatibility/assets/icon-256x256.png?rev=3046061)

# TiDB Compatibility

 By [xuliwen](https://profiles.wordpress.org/xuliwen/)

[Download](https://downloads.wordpress.org/plugin/tidb-compatibility.1.0.3.zip)

 * [Details](https://en-ca.wordpress.org/plugins/tidb-compatibility/#description)
 * [Reviews](https://en-ca.wordpress.org/plugins/tidb-compatibility/#reviews)
 * [Development](https://en-ca.wordpress.org/plugins/tidb-compatibility/#developers)

 [Support](https://wordpress.org/support/plugin/tidb-compatibility/)

## Description

TiDB is a high-performance database that is compatible with the MySQL protocol. 
Since MySQL has deprecated the SQL_CALC_FOUND_ROWS function, TiDB also has no intention
of offering the SQL_CALC_FOUND_ROWS function. This leads to an error in WordPress
when using TiDB, indicating that SQL_CALC_FOUND_ROWS is not supported, and submissions
cannot be displayed correctly.

WordPress is also currently working on this issue, but it seems that more time is
needed. #47280 Remove usage of deprecated MySQL SQL_CALC_FOUND_ROWS from WP_Query

This plugin solves the issue of TiDB not providing the SQL_CALC_FOUND_ROWS function.
Once this plugin is activated, parts of WP_Query that use SQL_CALC_FOUND_ROWS will
be replaced with the COUNT(*) function.

This plugin is entirely based on the method mentioned by @akramipro in the article,
and this solution works perfectly and addresses the issue. I’ve turned this method
into a plugin so that those using TiDB can easily resolve this problem. Many thanks
to @akramipro for the excellent work, and I hope the official WordPress team can
address this issue sooner.

### Configuration

The plugin only rewrites queries when the database server reports itself as TiDB.

 * Define `WTC_DISABLE` as `true` in `wp-config.php` to switch the rewrite off.
 * Use the `tidb_compatibility_enabled` filter (from a plugin or must-use plugin,
   not a theme) to override the TiDB detection.
 * With `WP_DEBUG` enabled, the plugin logs to the PHP error log when it is inactive,
   when it keeps the core count query, and when its count query fails. Activation
   and deactivation are always logged.

### Contribute

Contribute to this plugin on [github.com/pingcap/wordpress-tidb-plugin](https://github.com/pingcap/wordpress-tidb-plugin)

## Reviews

![](https://secure.gravatar.com/avatar/801609f0c0abe81fae66192822c76c94bfe99eddf8460439edd98c3f53175273?
s=60&d=retro&r=g)

### 󠀁[Must have for TiDB users](https://wordpress.org/support/topic/must-have-for-tidb-users/)󠁿

 [Otto Kekäläinen](https://profiles.wordpress.org/ottok/) May 7, 2025

This plugin is a must-have if you are running TiDB as the database instead of MySQL/
MariaDB.

 [ Read all 1 review ](https://wordpress.org/support/plugin/tidb-compatibility/reviews/)

## Contributors & Developers

“TiDB Compatibility” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ xuliwen ](https://profiles.wordpress.org/xuliwen/)
 *   [ it2911 ](https://profiles.wordpress.org/it2911/)

[Translate “TiDB Compatibility” into your language.](https://translate.wordpress.org/projects/wp-plugins/tidb-compatibility)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/tidb-compatibility/),
check out the [SVN repository](https://plugins.svn.wordpress.org/tidb-compatibility/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/tidb-compatibility/)
by [RSS](https://plugins.trac.wordpress.org/log/tidb-compatibility/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.0.3

 * Security: count found posts from the executed query, so pagination totals no 
   longer include posts hidden by query filters or suppress_filters
 * Security: only strip the leading SQL_CALC_FOUND_ROWS keyword, so string literals
   in queries are never modified
 * Only activate on TiDB, add the WTC_DISABLE constant and tidb_compatibility_enabled
   filter
 * Log activation, deactivation and count query fallbacks or failures

#### 1.0.2

 * Update README, tags

#### 1.0.1

 * Update README, tags and compatibility info

## Meta

 *  Version **1.0.3**
 *  Last updated: **6 days ago**
 *  Active installations: **70+**
 *  WordPress Version: ** 4.7 or higher **
 *  Tested up to: **6.8.12**
 *  PHP Version: ** 7.0 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/tidb-compatibility/)
 * Tags:
 * [database](https://en-ca.wordpress.org/plugins/tags/database/)[sql](https://en-ca.wordpress.org/plugins/tags/sql/)
 *  [Advanced View](https://en-ca.wordpress.org/plugins/tidb-compatibility/advanced/)

## Ratings

 5 out of 5 stars.

 *  [  1 5-star review     ](https://wordpress.org/support/plugin/tidb-compatibility/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/tidb-compatibility/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/tidb-compatibility/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/tidb-compatibility/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/tidb-compatibility/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/tidb-compatibility/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/tidb-compatibility/reviews/)

## Contributors

 *   [ xuliwen ](https://profiles.wordpress.org/xuliwen/)
 *   [ it2911 ](https://profiles.wordpress.org/it2911/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/tidb-compatibility/)