WordPress Hooks

Action and filter hooks — the backbone of WordPress extensibility. Snippets for init, wp_enqueue_scripts, save_post, pre_get_posts, and dozens more.

PHP
This code snippet filters WordPress post queries based on custom conditions, specifically by category, using the 'pre_get_posts' action hook. It is us...

WordPress Custom Hook For Filtering Post Queries By Category

PHP
This code snippet provides a custom WordPress hook to filter posts dynamically based on specific conditions such as post meta, categories, or tags. It...

Dynamic WordPress Post Filtering Using Custom Hooks

PHP
Register a custom Gutenberg block pattern with category — reusable hero section pattern with heading, paragraph, and CTA button.

Register Custom Gutenberg Block Pattern

PHP
Complete AJAX handler pattern with nonce verification, input sanitization, proper error handling, and script localization.

Secure AJAX Handler with Nonce Verification