From 3980e6b5addf18c1c0a5c48c62c0fe6dcc3ba6da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20S=C3=B8derlind?= Date: Thu, 2 Oct 2025 06:16:06 +0200 Subject: [PATCH] WordPress Instruction (#277) * Add comprehensive WordPress development instructions for Copilot - Introduced a detailed guide covering core principles, coding standards, security practices, internationalization, performance optimization, admin UI, REST API, block development, asset loading, testing strategies, and documentation best practices. - Emphasized the importance of following WordPress Coding Standards (WPCS) and provided examples for plugin headers, linting setup, and security measures. - Included a checklist to ensure compliance with best practices for plugin development. * Add WordPress development instructions for Copilot, detailing coding, security, and testing rules for plugins and themes * Fix formatting inconsistencies in WordPress instructions file by changing double quotes to single quotes for 'applyTo' and 'description' fields. --- README.instructions.md | 1 + instructions/wordpress.instructions.md | 186 +++++++++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 instructions/wordpress.instructions.md diff --git a/README.instructions.md b/README.instructions.md index 9a59be6..60b04cc 100644 --- a/README.instructions.md +++ b/README.instructions.md @@ -94,3 +94,4 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for | [Terraform Conventions](instructions/terraform.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fterraform.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fterraform.instructions.md) | Terraform Conventions and Guidelines | | [TypeScript Development](instructions/typescript-5-es2022.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Ftypescript-5-es2022.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Ftypescript-5-es2022.instructions.md) | Guidelines for TypeScript Development targeting TypeScript 5.x and ES2022 output | | [VueJS 3 Development Instructions](instructions/vuejs3.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fvuejs3.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fvuejs3.instructions.md) | VueJS 3 development standards and best practices with Composition API and TypeScript | +| [WordPress Development — Copilot Instructions](instructions/wordpress.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fwordpress.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fwordpress.instructions.md) | Coding, security, and testing rules for WordPress plugins and themes | diff --git a/instructions/wordpress.instructions.md b/instructions/wordpress.instructions.md new file mode 100644 index 0000000..2c08bbd --- /dev/null +++ b/instructions/wordpress.instructions.md @@ -0,0 +1,186 @@ +--- +applyTo: 'wp-content/plugins/**,wp-content/themes/**,**/*.php,**/*.inc,**/*.js,**/*.jsx,**/*.ts,**/*.tsx,**/*.css,**/*.scss,**/*.json' +description: 'Coding, security, and testing rules for WordPress plugins and themes' +--- + +# 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 `