25% off ProSNIPC25OFF

Snippet library

WordPress code snippets, ready to use.

707 free & Pro snippets and modules. Copy-paste-ready, or import in one click with SnipCraft.

PHP

Elementor: Disable Default Typography Presets

Stops Elementor from loading its built-in typography presets so the active theme's font stack is not overridden.

#branding#design#elementor
PHP

Elementor: Disable Default Color Palettes

Prevents Elementor from injecting its built-in default color scheme so the site's own global colors remain the sole source of truth.

#branding#colors#design
PHPPro

Elementor: Register Custom Theme Builder Location

Registers a custom Theme Builder template location (hero slot) that Elementor Pro templates can target and render in the theme.

#elementor#location#pro
PHPPro

Elementor: Filter Posts Widget Query by Query ID

Modifies the WP_Query for a specific Elementor Posts/Archive widget by matching the Query ID set in the widget Content panel.

#elementor#loop#portfolio
PHPPro

Elementor: Register Custom Widget Category

Adds a custom group category to the Elementor widget panel so bespoke widgets can be visually separated from built-in ones.

#admin#customization#editor
PHPPro

Add a Send Test Email Admin Tool

Adds a Tools > Test Email page in the WordPress admin where site administrators can send a test email to verify SMTP and mail-server deliverability.

#admin#debugging#deliverability
PHP

Hide Admin Update Notifications (Keep Emails)

Suppresses core, plugin, and theme update nags in the WordPress dashboard for users who cannot perform updates, while leaving background email alerts intact.

#admin#cleanup#notifications
PHPPro

Change WooCommerce Order Email Recipients

Routes WooCommerce new-order, cancelled-order, and failed-order emails to additional recipients defined via a filterable list, including the admin address.

#email#notifications#orders
PHP

Customize WooCommerce Email Footer Text

Replaces the default WooCommerce email footer text with your brand name and site URL using a simple filter.

#branding#email#footer
JavaScriptPro

Phone Number Input Mask for Forms

Applies a live (999) 000-0000 US phone number mask to all telephone inputs on the page as the user types, with no jQuery dependency.

#forms#input-mask#javascript
PHP

Enable Pinch-to-Zoom on Mobile

Replaces any restrictive viewport meta tag (one that sets user-scalable=no or maximum-scale=1) with a permissive one that allows pinch-to-zoom.

#accessibility#mobile#responsive
CSSPro

CSS Floating Form Labels

Provides a complete material-style floating label pattern: the label slides up and shrinks when the input receives focus or contains a value.

#animation#css#forms
JavaScriptPro

Warn Before Leaving a Form with Unsaved Changes

Shows a browser "leave page?" warning when a user navigates away from any form that has been edited but not submitted.

#beforeunload#forms#javascript
JavaScript

Add a "Scrolled" Class to Body on Scroll

Adds a "scrolled" CSS class to the <body> element once the page is scrolled past a configurable threshold, enabling CSS-driven sticky header or nav changes.

#css#frontend#javascript
JavaScriptPro

Fade-In Page Transitions

Fades the page out before navigating to a same-origin link and fades it back in on load, creating smooth cross-page transitions without a framework.

#animation#frontend#javascript
JavaScriptPro

Disable Right-Click and Text Copying

Suppresses right-click context menus and clipboard copy events across the page to provide basic content-copy protection.

#content-protection#copyright#frontend
JavaScript

Add Show/Hide Password Toggle to Login Form

Appends a Show / Hide button beside the password field on the WordPress login page so users can reveal their password while typing.

#javascript#login#password
JavaScript

Logout Confirmation Prompt

Intercepts clicks on logout links site-wide and shows a browser confirm dialog before completing the sign-out request.

#confirmation#javascript#logout
PHP

Remove Default Author Contact Method Fields

Removes the legacy AIM, Yahoo IM, and Jabber/XMPP contact method rows from the WordPress user profile screen.

#admin#cleanup#contact-methods
PHPPro

Add Custom Profile Fields for Users

Adds arbitrary editable text fields (job title, company, phone) to the WordPress user profile and stores each value as user meta.

#admin#custom-fields#profile
PHP

Add Social Media Links to User Profiles

Adds Twitter/X, LinkedIn, and GitHub URL fields to the WordPress user profile screen and saves them as user meta.

#admin#contact-fields#profile
PHP

Set Display Name to Username on Registration

Sets new users' display name to their login username on registration so their real name is not exposed publicly by default.

#display-name#privacy#registration
PHP

Redirect Users to the Previous Page After Login

Sends users back to the page they were visiting before the login form, falling back to the default WordPress redirect when no referer exists.

#login#redirect#registration
PHPPro

Add VideoObject Schema for Embedded Videos

Detects the first YouTube or Vimeo embed in a singular post and outputs a JSON-LD VideoObject schema block to enable video rich results.

#json-ld#rich-snippets#schema