WordPress.DB.DirectDatabaseQuery.DirectQuery
Direct Query
The plugin runs a direct database query instead of using a higher-level WordPress API or cache-aware pattern.
Why It Shows Up
Plugin Check found `$wpdb` access that queries the database directly, changes schema, or bypasses normal caching expectations.
Why It Matters
Direct queries can be correct, but they are easier to make unsafe, slower at scale, and harder for WordPress to cache or filter.
How to Fix
- Use WordPress APIs such as post, term, metadata, option, or user functions when they fit the task.
- If direct SQL is necessary, prepare dynamic values and add a clear caching strategy for repeated reads.
- Keep schema changes in activation or upgrade routines and make them idempotent.
References
Affected Plugins
| Rank | Plugin | Score | Errors | Warnings | Installs | Added | Updated | Top Issue |
|---|---|---|---|---|---|---|---|---|
| #3501 | HBAgency | 98 | 1 | 16 | 9k+ | Non-prefixed global variable | ||
| #3502 | Local Fonts Uploader – Upload & Host Any Font Locally for GDPR | 98 | 1 | 10 | 4k+ | Direct Query | ||
| #3503 | Mime Types Plus | 98 | 1 | 12 | 10k+ | Non-prefixed global variable | ||
| #3504 | Plus WebP or AVIF | 98 | 24 | 5k+ | Non-prefixed global variable | |||
| #3505 | ProvenExpert | 98 | 8 | 10 | 900 | wp function not compatible with requires wp | ||
| #3506 | Swift Switcher — Bulk & Custom Post Type Converter | 98 | 1 | 5 | 600 | Direct Query | ||
| #3507 | Trust Badges | 98 | 1 | 4 | 1k+ | Direct Query | ||
| #3508 | WP Database Reset | 98 | 1 | 10 | 5k+ | Direct Query | ||
| #3509 | Chart Block – Visualize Data with Bar, Line, Pie Charts | 99 | 9 | 1k+ | Non-prefixed constant | |||
| #3510 | Machete | 99 | 7 | 7k+ | Direct Query | |||
| #3511 | Media Library Tools – AI-Powered Rename, Clean & CSV Import/Export | 99 | 1 | 4 | 1k+ | Discouraged PHP function | ||
| #3512 | Ogp Plus | 99 | 1 | 6 | 500 | Non-prefixed global variable | ||
| #3513 | Simple Ticker | 99 | 1 | 7 | 500 | Non-prefixed global variable | ||
| #3514 | Statify Filter | 99 | 6 | 2k+ | Direct Query | |||
| #3515 | VS Meta Description | 99 | 1 | 3 | 3k+ | Direct Query |