Skip to content

secondsky/claude-skills / plugins/wordpress-plugin-core/skills/wordpress-plugin-core

wordpress-plugin-core

Flagged

WordPress plugin development with hooks, security, REST API, custom post types. Use for plugin creation, $wpdb queries, Settings API, or encountering SQL injection, XSS, CSRF, nonce errors.

FileKindSize
SKILL.mdskill md17.9 KB
assets/example-template.txtmarkdown416 B
examples/github-updater.phpscript15.3 KB
references/advanced-topics.mdmarkdown16.6 KB
references/common-hooks.mdmarkdown2.7 KB
references/common-patterns.mdmarkdown13.1 KB
references/error-catalog.mdmarkdown16.3 KB
references/example-reference.mdmarkdown760 B
references/github-auto-updates.mdmarkdown30.3 KB
references/plugin-architectures.mdmarkdown21.0 KB
references/security-checklist.mdmarkdown11.7 KB
scripts/example-script.shexecutablescript302 B
scripts/scaffold-plugin.shexecutablescript9.0 KB
templates/examples/ajax-handler.phpscript8.0 KB
templates/examples/custom-post-type.phpscript9.5 KB
templates/examples/meta-box.phpscript6.3 KB
templates/examples/rest-endpoint.phpscript8.7 KB
templates/examples/settings-page.phpscript7.9 KB
templates/plugin-oop/README.mdmarkdown7.4 KB
templates/plugin-oop/my-oop-plugin.phpscript12.5 KB
templates/plugin-oop/uninstall.phpscript929 B
templates/plugin-oop/views/admin-settings.phpscript2.1 KB
templates/plugin-psr4/README.mdmarkdown9.7 KB
templates/plugin-psr4/composer.jsonconfig706 B
templates/plugin-psr4/my-psr4-plugin.phpscript1.7 KB
templates/plugin-psr4/src/API/BookEndpoints.phpscript5.3 KB
templates/plugin-psr4/src/Admin/Settings.phpscript5.1 KB
templates/plugin-psr4/src/Frontend/Assets.phpscript2.0 KB
templates/plugin-psr4/src/Plugin.phpscript2.4 KB
templates/plugin-psr4/src/PostTypes/Book.phpscript4.9 KB
templates/plugin-psr4/src/Taxonomies/Genre.phpscript1.9 KB
templates/plugin-psr4/uninstall.phpscript929 B
templates/plugin-simple/README.mdmarkdown4.6 KB
templates/plugin-simple/my-simple-plugin.phpscript7.4 KB
templates/plugin-simple/uninstall.phpscript1.3 KB

templates/plugin-simple/README.md

View on GitHub
# Simple WordPress Plugin Template

This is a functional programming pattern for WordPress plugins. Best for small to medium plugins that don't require complex object-oriented architecture.

## Features

✅ Complete plugin header with all fields
✅ ABSPATH security check
✅ Unique function prefix (mysp_)
✅ Custom post type registration (Books)
✅ Admin settings page with nonce verification
✅ AJAX handler with security checks
✅ Proper activation/deactivation hooks
✅ Uninstall script for cleanup
✅ Internationalization ready
✅ Conditional asset loading
✅ Security best practices (sanitization, escaping, capability checks)

## Installation

1. Copy this folder to `wp-content/plugins/`
2. Rename folder and files to match your plugin name
3. Find and replace the following:
   - `My Simple Plugin` → Your plugin name
   - `my-simple-plugin` → your-plugin-slug
   - `mysp_` → yourprefix_
   - `MYSP_` → YOURPREFIX_
   - `https://example.com` → Your website
   - `Your Name` → Your name
4. Activate in WordPress admin

## Structure

```
my-simple-plugin/
├── my-simple-plugin.php    # Main plugin file
├── uninstall.php            # Cleanup on uninstall
├── README.md                # This file
├── assets/                  # CSS/JS files (create as needed)
│   ├── css/
│   │   ├── admin-style.css
│   │   └── style.css
│   └── js/
│       ├── admin-script.js
│       └── script.js
└── languages/               # Translation files (create as needed)
```

## Included Examples

### Custom Post Type
- Registers "Books" post type
- Gutenberg-enabled
- Archive page support
- Custom rewrite slug

### Settings Page
- Located in Settings → Simple Plugin
- Nonce verification
- Sanitization and validation
- Settings error handling

### AJAX Handler
- Action: `wp_ajax_mysp_action`
- Nonce verification
- Capability checking
- JSON response

### Activation/Deactivation
- Flushes rewrite rules
- Sets default options
- Cleans up scheduled events

### Uninstall
- Deletes all plugin options
- Clears transients
- Multisite support
- Optional: Delete custom post type data

## Security Checklist

- [x] ABSPATH check at top of file
- [x] Unique function prefix (mysp_)
- [x] Nonces for all forms
- [x] Capability checks (current_user_can)
- [x] Input sanitization (sanitize_text_field)
- [x] Output escaping (esc_html, esc_attr)
- [x] AJAX nonce verification (check_ajax_referer)
- [x] Conditional asset loading (don't load everywhere)
- [x] Proper uninstall cleanup

## Next Steps

1. Create the `assets/` directory structure
2. Add your CSS and JavaScript files
3. Extend with additional features:
   - Meta boxes
   - Shortcodes
   - Widgets
   - REST API endpoints
   - Custom taxonomies
   - WP-CLI commands

## Distribution & Auto-Updates

### Enabling GitHub Auto-Updates

You can provide automatic updates from GitHub without submitting to WordPress.org:

**1. Install Plugin Update Checker library:**

```bash
cd your-plugin/
git submodule add https://github.com/YahnisElsts/plugin-update-checker.git
```

**2. Add to your main plugin file:**

```php
// Include Plugin Update Checker
require plugin_dir_path( __FILE__ ) . 'plugin-update-checker/plugin-update-checker.php';
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

// Initialize update checker
$updateChecker = PucFactory::buildUpdateChecker(
    'https://github.com/yourusername/your-plugin/',
    __FILE__,
    'your-plugin-slug'
);

// Set branch (default: main)
$updateChecker->setBranch( 'main' );

// Use GitHub Releases (recommended)
$updateChecker->getVcsApi()->enableReleaseAssets();
```

**3. For private repos, add token to wp-config.php:**

```php
define( 'YOUR_PLUGIN_GITHUB_TOKEN', 'ghp_xxxxxxxxxxxxx' );
```

Then in your plugin:

```php
if ( defined( 'YOUR_PLUGIN_GITHUB_TOKEN' ) ) {
    $updateChecker->setAuthentication( YOUR_PLUGIN_GITHUB_TOKEN );
}
```

**4. Create releases:**

```bash
# Update version in plugin header
git add my-simple-plugin.php
git commit -m "Bump version to 1.0.1"
git tag 1.0.1
git push origin main
git push origin 1.0.1

# Create GitHub Release (optional but recommended)
# - Upload pre-built ZIP file
# - Add release notes
```

### Resources

- **Complete Guide**: See `references/github-auto-updates.md`
- **Implementation Examples**: See `examples/github-updater.php`
- **Plugin Update Checker**: https://github.com/YahnisElsts/plugin-update-checker

## Resources

- [WordPress Plugin Handbook](https://developer.wordpress.org/plugins/)
- [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/)
- [Plugin Security](https://developer.wordpress.org/apis/security/)

## License

GPL v2 or later
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall