Snippet library
PHP snippets for WordPress.
467 free & Pro snippets and modules. Copy-paste-ready, or import in one click with SnipCraft.
CPT and Taxonomy Label Generator Helper
Provides a helper function that auto-generates a full labels array for any post type or taxonomy from a singular and plural name.
Register a Custom Taxonomy
Registers a reusable hierarchical custom taxonomy and attaches it to posts and a custom post type, with REST API support.
Register an Events Post Type
Registers an Events custom post type with start/end date meta fields, REST API support, and a chronological archive slug.
Register a Team Members Post Type
Registers a Team Members custom post type with custom fields support for staff profiles, bios, and role information.
Register a Services Post Type
Registers a Services custom post type with an archive, excerpt, and thumbnail support for service listing pages.
Register an FAQ Post Type
Registers an FAQ custom post type with REST API support so FAQ entries can be managed in the admin and queried via the block editor.
Register a Testimonials Post Type
Registers a Testimonials custom post type with a public archive, admin UI, and support for title, editor, and thumbnail.
Notify Author When Post Published
Emails the post author when their content transitions to published status, with a link to view the live post.
Notify Admin on Contributor Submission
Sends the admin an email when a contributor submits a post for review, including the post title and an admin review link.
Customize Password Reset Email
Replaces the default password-reset email with a branded HTML message that includes the site name and a styled reset link.
Customize New User Welcome Email
Replaces the default WordPress new-user notification with a branded HTML welcome email that includes the site name and login URL.
Disable Admin Email Verification Prompt
Removes the periodic WordPress nag that asks administrators to confirm their email address is still current.
Disable Admin Password-Change Emails
Stops WordPress from sending the admin notification email whenever a user changes their password.
Disable Automatic Update Emails
Suppresses all automatic core, plugin, and theme update notification emails to keep the inbox quiet.
Log All Outgoing Emails
Captures every outgoing WordPress email — recipient, subject, and timestamp — into a custom database table for delivery debugging.
Add BCC to Outgoing Emails
Silently BCCs every outgoing WordPress email to an archive address for compliance or debugging purposes.
Set a Custom Reply-To Address
Adds a Reply-To header to every outgoing WordPress email so replies route to a chosen address instead of the sender.
Set Email Content Type to HTML
Forces all outgoing WordPress emails to use text/html content type so HTML markup renders in mail clients.
Add Continue Shopping Button to Cart Page
Adds a Continue Shopping button to the WooCommerce cart page that links back to the shop, giving customers an easy way to return to browsing without using the browser back button.
Add WhatsApp Enquiry Button to Product Page
Adds a click-to-chat WhatsApp button on single product pages that pre-fills a message with the product name and URL, letting customers enquire or order via WhatsApp.
Display Remaining Stock Quantity on Products
Replaces the generic 'In stock' availability text on WooCommerce product pages with the actual remaining stock count when stock management is enabled for the product.
Restyle Sale Badge With Percentage Off
Replaces the generic WooCommerce 'Sale!' badge with a calculated percentage-off label (e.g. '-25%') for simple products; variable products keep the original badge.
Register a Custom WooCommerce Order Status
Registers an 'Awaiting Fulfilment' order status as a custom post status and adds it to WooCommerce's order status dropdown, enabling custom workflow stages.
Exclude Specific Products From All Coupons
Prevents WooCommerce coupons from being valid for a defined list of product IDs, protecting margin on premium or already-discounted items regardless of the coupon's own exclude settings.