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 / buddyboss-product-gallery-thumbs-fix.js
Created June 4, 2026 15:22
BuddyBoss theme: fix WooCommerce product gallery thumbnails hidden by Slick init race condition
@vapvarun
vapvarun / 01-featured-image-template.html
Created June 4, 2026 04:11
HTML + Playwright Featured Image Workflow (vapvarun.com)
@vapvarun
vapvarun / 01-wp-contributor-env.sh
Created June 4, 2026 03:15
WordPress Contributor Environment Setup - attowp.com
# Clone wordpress-develop
git clone https://github.com/WordPress/wordpress-develop.git
cd wordpress-develop
# Install Node dependencies
npm install
# Start wp-env (requires Docker)
npx wp-env start
@vapvarun
vapvarun / 01-save-post-type-basic.php
Created June 4, 2026 03:14
WordPress Dynamic Hooks: save_post_{type}, manage_{screen}_columns, theme_mod_{name} — tweakswp.com
<?php
/**
* save_post_{$post_type} dynamic hook — basic usage
*
* The hook fires only when the specified post type is saved.
* Avoids the post_type check you would need on save_post.
*
* Tutorial: https://tweakswp.com/wordpress-dynamic-hooks-save-post-type/
*/
@vapvarun
vapvarun / shutdown-gotchas.php
Created June 4, 2026 03:11
WordPress shutdown action gotchas: headers, object cache, timeouts - tweakswp.com tutorial
<?php
/**
* Common gotchas when using the WordPress shutdown action
*
* Covers: headers-already-sent, object cache availability,
* timeout behavior, and output buffer state.
*
* Tutorial: https://tweakswp.com/
*/
@vapvarun
vapvarun / shutdown-fatal-error-capture.php
Created June 4, 2026 03:11
Capture PHP fatal errors on WordPress shutdown with logging and Slack alert - tweakswp.com tutorial
<?php
/**
* Capture fatal errors on WordPress shutdown
*
* WordPress catches many errors through WP_Error and wp_die(), but PHP-level
* fatal errors (E_ERROR, E_PARSE) kill the script before any WordPress handler
* can run. register_shutdown_function() is the only way to intercept them.
*
* Tutorial: https://tweakswp.com/
*/
@vapvarun
vapvarun / shutdown-fastcgi-finish-request.php
Created June 4, 2026 03:11
fastcgi_finish_request with WordPress shutdown action pattern - tweakswp.com tutorial
<?php
/**
* fastcgi_finish_request() in WordPress: correct usage pattern
*
* Demonstrates how to use fastcgi_finish_request() to close the HTTP
* connection and continue background work, with the checks needed to
* avoid common pitfalls.
*
* Tutorial: https://tweakswp.com/
*/
@vapvarun
vapvarun / shutdown-external-api-after-response.php
Created June 4, 2026 03:11
Send data to external API after response is complete using WordPress shutdown - tweakswp.com tutorial
<?php
/**
* Sending data to an external API after the response is complete
*
* Uses fastcgi_finish_request() to flush output to the browser, then
* fires the WordPress 'shutdown' action to POST data to an external
* endpoint without blocking the user's page load.
*
* Tutorial: https://tweakswp.com/
*/
@vapvarun
vapvarun / shutdown-deferred-logging.php
Created June 4, 2026 03:11
Deferred batch event logging on WordPress shutdown action - tweakswp.com tutorial
<?php
/**
* Deferred event logging on the WordPress shutdown action
*
* Buffers log entries during the request and writes them all to the database
* in a single batch on shutdown. Avoids per-event DB writes in hot paths.
*
* Tutorial: https://tweakswp.com/
*/
@vapvarun
vapvarun / shutdown-action-vs-register-shutdown.php
Created June 4, 2026 03:11
WordPress shutdown action vs register_shutdown_function - tweakswp.com tutorial
<?php
/**
* WordPress shutdown action vs register_shutdown_function
*
* Demonstrates the two mechanisms for running code after WordPress
* has finished processing. The 'shutdown' action fires within the
* WordPress lifecycle; register_shutdown_function fires at PHP level
* after output is flushed.
*
* Tutorial: https://tweakswp.com/