AI Snippet verification score

In the Cloud library, every public Code Snippet now includes an AI snippet verification score, which can be found right below the code editor.

How the AI Verification Score Works

This score is automatically calculated via our AI model, and automatically performs a number of checks on the snippet. By default, you will see an average snippet score, but you can expand the panel for a full breakdown of individual benchmarks like:

  • Style
    • Checks: indentation, spacing, naming conventions, readability, inline comments, adherence to WP/PSR coding standards.
    • Positive example: modern PHP syntax, type hints, descriptive variable names.
    • Negative example: inconsistent spacing, unclear variable names, no comments.
  • Security
    • Checks: data sanitization/escaping, nonce usage, capability checks, SQL/XSS prevention.
    • Positive: sanitize_text_field(), esc_html(), current_user_can().
    • Negative: raw database queries with unescaped variables, missing wp_nonce_* checks.
  • Performance
    • Checks: algorithmic efficiency, query optimization, memory usage, async/deferred script loading.
    • Positive: caching with wp_cache_*, avoiding queries in loops.
    • Negative: heavy loops, redundant API calls, synchronous blocking JS.
  • Compatibility
    • Checks: use of WordPress core APIs, compatibility with PHP ≥ 7.4, vanilla JS (no theme-dependent code).
    • Positive: add_action(), wp_enqueue_script() with WP hooks.
    • Negative: reliance on non-core functions, deprecated APIs, hardcoded theme paths.

Evaluation Chart

ScoreMeaningNotes
[ 1 ]Severe issuesLikely to break functionality, pose major security risks, or be unreadable.
[ 2 ]Many issuesPoor practices across multiple areas; significant refactoring is suggested.
[ 3 ]Minor issuesWorks but has some notable improvement opportunities.
[ 4 ]AcceptableWell-written but slightly improvable.
[ 5 ]ExemplaryMeets or exceeds modern best practices.

Each evaluation axis receives a score from 1 (severe issues) to 5 (exemplary practices), helping you identify where a snippet excels or where it might need improvement.

Behind the Scenes: Best-Practice Benchmarks

The AI-based verification draws from a rich knowledge base, including:

The output is a clear, actionable report to help you confidently review and maintain snippets.

Using the AI Score in Your Workflow

When you select a snippet from the Cloud library, check the AI verification score beneath the editor. For deeper insights, expand the score panel to see Style, Security, Performance, and Compatibility ratings along with helpful notes on what’s working well or what could be improved instead.

Note: The AI verification score can still miss some important security issues. Please always use snippets with caution, regardless of the indicated score.