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-create-user.sh
Created February 23, 2026 20:01
WordPress on DigitalOcean — Complete Server Setup Guide (Ubuntu 24.04 + Nginx + MySQL 8 + PHP 8.3 + Redis)
#!/bin/bash
# Create a sudo user and disable root SSH login
# Run this as root on your fresh DigitalOcean droplet
set -euo pipefail
USERNAME="deploy"
# Create user with home directory
adduser --disabled-password --gecos "" "$USERNAME"
@vapvarun
vapvarun / disable-bp-activation-email.md
Created February 23, 2026 20:06
Disable BuddyPress Activation Email — auto-activate signups instantly

Disable BuddyPress Activation Email

Bypasses the activation email and auto-activates new user signups immediately.

How to Use

Add the following code to one of these locations:

  • bp-custom.php (recommended — place in wp-content/plugins/bp-custom.php)
  • Your child theme's functions.php
@vapvarun
vapvarun / 01-create-staging-db.sh
Created February 23, 2026 20:19
WordPress Staging Site on DigitalOcean — Subdomain & Temp Domain (vapvarun.com)
#!/bin/bash
# Create staging database and clone production data
# Run as root or with sudo on your DigitalOcean droplet
# --- Configuration ---
PROD_DB="wordpress_prod"
STAGING_DB="wordpress_staging"
STAGING_DB_USER="staging_user"
STAGING_DB_PASS="$(openssl rand -base64 24)"
@vapvarun
vapvarun / 01-theme-json-font-family.json
Created February 24, 2026 19:17
How to Add Custom Fonts to Block Themes Without Plugins (brndle.com)
{
"version": 3,
"settings": {
"typography": {
"fontFamilies": [
{
"fontFamily": "\"Inter\", sans-serif",
"name": "Inter",
"slug": "inter",
"fontFace": [
@vapvarun
vapvarun / 01-edd-sales-report-query.php
Created February 24, 2026 19:22
EDD Analytics and Reporting: Complete Guide (eddsellservices.com)
<?php
/**
* Query EDD sales data using the built-in Reports API.
*
* EDD 3.0+ uses custom database tables for orders,
* replacing the old post-based system. This function
* demonstrates how to fetch sales stats programmatically
* using the EDD\Stats class.
*
* @since EDD 3.0
@vapvarun
vapvarun / 01-pre-migration-audit.php
Created February 24, 2026 19:31
How to Migrate from Shopify to WooCommerce (woosellservices.com)
<?php
/**
* Pre-migration audit: Verify WooCommerce readiness.
*
* Checks that WooCommerce is properly configured to
* receive migrated Shopify data. Run this before starting
* any migration to catch issues early and avoid data loss
* during the import process.
*
* @return array Audit results with pass/fail for each check.
@vapvarun
vapvarun / 01-set-upsell-products.php
Created February 24, 2026 19:35
WooCommerce Upsell and Cross-Sell: Complete Guide (woosellservices.com)
<?php
/**
* Programmatically set upsell products for a WooCommerce product.
*
* WooCommerce stores upsell product IDs in post meta. This
* function demonstrates how to set upsells via code, which
* is useful when migrating data, syncing from an ERP, or
* building automated product recommendation logic.
*
* @param int $product_id The product to add upsells to.
@vapvarun
vapvarun / 01-salt-keys.php
Created February 24, 2026 19:54
WordPress Security Hardening: 10 wp-config and Server-Level Tweaks - Code examples for salt keys, file editing lockdown, security headers, XML-RPC blocking, and IP restriction
<?php
/**
* WordPress Security: Unique Salt Keys in wp-config.php
*
* Generate fresh keys at: https://api.wordpress.org/secret-key/1.1/salt/
* Replace ALL keys every 6-12 months or after a security incident.
*
* Each key must be unique and at least 60 characters long.
*/
@vapvarun
vapvarun / register-buddypress-group-types.php
Created February 24, 2026 19:54
BuddyPress Group Types Registration - Register custom group types (study groups, project teams) with directory support
<?php
/**
* BuddyPress Group Types Registration
*
* Register custom group types to organize BuddyPress groups by purpose.
* Add this code to your theme's functions.php or a custom plugin.
*
* Group types allow you to categorize groups (e.g., study groups, project teams)
* and filter the group directory by type. Each type can appear in the directory
* and optionally show a type badge on the group header.
@vapvarun
vapvarun / 01-register-group-types.php
Created February 24, 2026 20:15
BuddyPress Private Groups: Custom Group Types (buddyxtheme.com)
<?php
/**
* Register custom BuddyPress group types.
*
* Add this to your theme's functions.php or a custom plugin.
* Group types appear as filter tabs in the group directory,
* letting members filter groups by Study Groups, Project Teams, etc.
*/
function register_custom_group_types() {
bp_groups_register_group_type( 'study-group', array(