Skip to content

Instantly share code, notes, and snippets.

View vapvarun's full-sized avatar
👋
AI Developer & WordPress Expert. Building MCP servers & Plugins

Varun Kumar Dubey vapvarun

👋
AI Developer & WordPress Expert. Building MCP servers & Plugins
View GitHub Profile
@vapvarun
vapvarun / 01-register-widget-areas.php
Created April 30, 2026 07:15
How to Migrate Widget Areas to Block Theme Template Parts (brndle.com)
<?php
/**
* Classic theme: registering widget areas (sidebars).
* This is the pattern that block themes replace with template parts.
*/
function mytheme_register_widget_areas() {
// Primary sidebar
register_sidebar( array(
'name' => __( 'Primary Sidebar', 'mytheme' ),
'id' => 'sidebar-1',
@vapvarun
vapvarun / buddyx-kirki-advisory.md
Last active April 30, 2026 09:55
BuddyX / BuddyX Pro advisory: Kirki 6.0.1 fatal-error fix

BuddyX and BuddyX Pro: Kirki 6.0.1 is causing fatal errors, here's the fix

Quick advisory for BuddyX and BuddyX Pro site owners.

We've identified a fatal-error pattern when Kirki 6.0.1 updates on a BuddyX or BuddyX Pro site that also runs BuddyPress and BP Profile Search. The site shows "There has been a critical error on this website" and the admin becomes inaccessible.

What's happening

Kirki 6.0.1 ships a one-time migration that runs too early in the WordPress lifecycle. With BuddyPress and BP Profile Search active, it triggers a null-reference fatal in WordPress core before the page can render.

@vapvarun
vapvarun / 01-admin-flows.spec.ts
Last active April 28, 2026 09:52
AI WP QA Tests: Playwright + PHPUnit for WordPress (vapvarun.com)
// admin-flows.spec.ts - Generated by Claude Code
// vapvarun.com: AI for WordPress QA Testers
import { test, expect } from '@playwright/test';
import { Admin, Editor } from '@wordpress/e2e-test-utils-playwright';
test.describe('Plugin Admin Settings', () => {
test.beforeEach(async ({ page }) => {
const admin = new Admin({ page });
await admin.visitAdminPage('options-general.php?page=my-plugin-settings');
});
@vapvarun
vapvarun / 01-mcp-server-skeleton.js
Created April 28, 2026 08:20
MCP Servers for WordPress (vapvarun.com) - Server patterns, REST API handlers, agentic loops
// MCP Server Skeleton for WordPress Agencies
// Pattern used in wp-blog, wpcs, and wp-malware-cleanup servers
// See: https://vapvarun.com/mcp-servers-wordpress-plugin-development/
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
CallToolRequestSchema,
ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";
@vapvarun
vapvarun / 01-aider-deepseek-setup.sh
Created April 28, 2026 08:18
Aider plus DeepSeek setup for WordPress plugin development (vapvarun.com)
# Install Aider
pip install aider-chat
# Set DeepSeek API key (get free credits at platform.deepseek.com)
export DEEPSEEK_API_KEY="your-deepseek-api-key-here"
# Navigate to your WordPress plugin directory
cd /path/to/wp-content/plugins/your-plugin
# Start Aider with DeepSeek coder backend
@vapvarun
vapvarun / gist:a7d5c23cbd73142368f1661241d39f16
Created April 28, 2026 07:51
Aider + Gemini Flash-Lite install and config for WordPress plugin development
# Aider + Gemini Flash-Lite: Install & Config for WordPress Plugin Dev
# Full guide: https://vapvarun.com/aider-gemini-flash-lite-free-ai-pair-programmer-wordpress/
# 1. Install Aider (recommended: pipx for isolation)
pip install aider-chat
# or:
pipx install aider-chat
# 2. Set your Gemini API key (get it free at aistudio.google.com)
# Add to ~/.zshrc or ~/.bashrc:
@vapvarun
vapvarun / 01-core-mode.php
Created April 28, 2026 07:50
WP_DEVELOPMENT_MODE: All 5 values with full wp-config.php examples (vapvarun.com)
<?php
// wp-config.php — Core development mode
// Use this when you are working on WordPress core patches,
// testing core REST API changes, or running Gutenberg block-editor experiments.
define( 'WP_DEVELOPMENT_MODE', 'core' );
// Pair it with the full debug stack so you catch every notice
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true ); // writes to wp-content/debug.log
@vapvarun
vapvarun / 00-claude-prompt.txt
Created April 28, 2026 07:41
AI Frontend Devs WordPress - Gutenberg Blocks with Claude + Copilot (vapvarun.com)
Scaffold a Gutenberg block for a WordPress plugin.
Namespace: wbcom
Block name: pricing-table
Slug: wbcom/pricing-table
Category: design
Icon: table
Attributes:
- title (string, default: "Pricing Plans")
@vapvarun
vapvarun / model-routing-wp-plugin-tasks.js
Created April 28, 2026 07:39
Claude Haiku WP Dev Benchmarks (vapvarun.com)
/**
* Model routing for WordPress plugin tasks in Claude Code.
* Routes tasks to the appropriate Claude model based on task type,
* file count, and whether security judgment is required.
*
* Usage: import and call routeToModel(taskType, fileCount, requiresSecurity)
* Returns: model ID string to pass as --model flag in Claude Code
*/
const MODELS = {
@vapvarun
vapvarun / 01-db-charset-collate.php
Created April 18, 2026 10:00
WordPress Database Connection: SSL, Charset, Collation, Repair (tweakswp.com)
<?php
/**
* DB_CHARSET and DB_COLLATE
*
* Place near the top of wp-config.php, before the "stop editing" line.
* These two constants control the character encoding and sort order used
* when WordPress connects to MySQL/MariaDB and when it creates new tables.
*
* Modern WordPress (4.2+) defaults to utf8mb4, which supports 4-byte
* characters like emoji, mathematical symbols, and many CJK code points.