Docs/Presets/WordPress

WordPress

Security and coding standards rules for WordPress themes and plugins.

Enabled Rules

RuleSeverityDescription
security/secret-detectionblockDetects database credentials and auth keys in theme/plugin files
security/env-exposureblockPrevents wp-config.php secrets from leaking
quality/naming-conventionsblockWordPress naming conventions (snake_case functions, prefixed globals)
quality/anti-patternswarnDirect database queries without $wpdb->prepare()
workflow/migration-safetywarnFlags dangerous SQL in activation/deactivation hooks

Usage

import { defineConfig } from '@solanticai/vguard';

export default defineConfig({
  presets: ['wordpress'],
});

What it enforces

  • No hardcoded credentials — Blocks database passwords, auth salts, and API keys written directly in PHP files. Use wp-config.php with environment variables.
  • Naming conventions — Functions must be snake_case with a plugin/theme prefix (mytheme_enqueue_scripts). Classes use PascalCase with prefix.
  • SQL injection prevention — Warns when $wpdb->query() is called without $wpdb->prepare() for parameterized queries.
  • Migration safety — Flags DROP TABLE and destructive SQL in plugin activation/deactivation hooks.