All SkillsGet Started Free
WordPress Development — Copilot Instructions
Coding, security, and testing rules for WordPress plugins and themes
MCP get_skill({ skillId: "wordpress-development-copilot-instructions-263a97ff" })Use this skill with your agent
Create a free account and connect via MCP
# WordPress Development — Copilot Instructions
**Goal:** Generate WordPress code that is secure, performant, testable, and compliant with official WordPress practices. Prefer hooks, small functions, dependency injection (where sensible), and clear separation of concerns.
## 1) Core Principles
- Never modify WordPress core. Extend via **actions** and **filters**.
- For plugins, always include a header and guard direct execution in entry PHP files.
- Use unique prefixes or PHP namespaces to avoid global collisions.
- Enqueue assets; never inline raw `<script>`/`<style>` in PHP templates.
- Make user‑facing strings translatable and load the correct text domain.
### Minimal plugin header & guard
```php
<?php
defined('ABSPATH') || exit;
/**
* Plugin Name: Awesome Feature
* Description: Example plugin scaffold.
* Version: 0.1.0
* Author: Example
* License: GPL-2.0-or-later
* Text Domain: awesome-feature
* Domain Path: /languages
*/
```
## 2) Coding Standards (PHP, JS, CSS, HTML)
- Follow **WordPress Coding Standards (WPCS)** and write DocBlocks for public APIs.
- PHP: Prefer strict comparisons (`===`, `!==`) where appropriate. Be consistent with array syntax and spacing as per WPCS.
- JS: Match WordPress JS style; prefer `@wordpress/*` packages for block/editor code.
- CSS: Use BEM‑like class naming when helpful; avoid over‑specific selectors.
- PHP 7.4+ compatible patterns unless the project specifies higher. Avoid using features not supported by target WP/PHP versions.
### Linting setup suggestions
```xml
<!-- phpcs.xml -->
<?xml version="1.0"?>
<ruleset name="Project WPCS">
<description>WordPress Coding Standards for this project.</description>
<file>./</file>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>node_modules/*</exclude-pattern>
<rule ref="WordPress"/>
<rule ref="WordPress-Docs"/>
<rule ref="WordPress-Extra"/>
<rule ref="PHPCompatibility"/>
<config name="testVersion" value="7.4-"/>
</ruleset>
```
#github-copilot#backend#developmentwordpress