PortGate

Advisories · WordPress

CVE-2022-21661 High CVSS 8.0

WordPress core WP_Query SQL injection

Disclosed 2022 · Last reviewed 2 Dec 2026

A crafted query argument could inject SQL through WP_Query on unpatched WordPress.

What happened

A meta query accepted an operator that was then placed into SQL.

Affected and patched versions

Affected
WordPress before 5.8.3, and the security releases on older branches.
Patched
5.8.3 and the matching security releases for older branches.

How to check your server

Check

wp core version

How to fix and harden

  1. Run wp core version.
  2. Update WordPress. Older branches received their own security release, so compare the branch you run with the WordPress security announcement.
  3. Take a backup before a core update.

Fix

wp core update

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON