25% off ProSNIPC25OFF

Snippet library

PHP snippets for WordPress.

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

PHPPro

EDD: Redirect to Custom Page After Successful Purchase

Redirects customers to a custom thank-you page after an EDD purchase completes instead of the default EDD success page.

#checkout#conversion#edd
PHPPro

EDD: Auto-Complete Free (Zero-Total) Purchases

Automatically transitions EDD payments with a zero total from pending to complete, skipping manual fulfilment for free downloads.

#automation#edd#free-downloads
PHP

EDD: Skip Cart and Go Straight to Checkout

Bypasses the EDD cart page entirely and sends customers directly to the checkout page when they click a purchase button.

#cart#checkout#conversion
PHP

EDD: Change Add-to-Cart Button Text

Replaces the default "Add to Cart" label on EDD download purchase links with custom text site-wide.

#buttons#checkout#customization
PHP

ACF: Hide a Field Group from Non-Admins

Hides every field belonging to a specific ACF field group from users who do not have the manage_options capability by returning false from acf/prepare_field.

#acf#admin#field-group
PHPPro

ACF: Enable ACF Fields in the REST API

Enables ACF's built-in REST API support (requires ACF 5.11+) so custom field values are exposed under the 'acf' key on post, term, and user REST responses.

#acf#api#custom-fields
PHP

ACF: Display Repeater Rows via Shortcode

Registers a [scseed_acf_repeater field="my_repeater" sub="item"] shortcode that iterates a repeater field and outputs its rows as a list.

#acf#custom-fields#frontend
PHPPro

ACF: Sync Field-Group JSON to a Custom Folder

Redirects ACF's JSON save/load paths to an acf-json folder inside the active theme, keeping field-group definitions in version control.

#acf#field-groups#json-sync
PHPPro

ACF: Auto-Generate Post Title from ACF Fields

After ACF saves a 'scseed_person' post, automatically sets its title and slug to the concatenated 'first_name' and 'last_name' field values.

#acf#automation#custom-fields
PHP

ACF: Make a Field Read-Only in Admin

Marks an ACF field named 'scseed_generated_id' as disabled and read-only in the admin edit screen so it cannot be changed manually.

#acf#admin#custom-fields
PHP

ACF: Set Field Default Value Dynamically

Sets a programmatic default for an ACF date field named 'scseed_publish_date' to today's date when the field has no saved value.

#acf#admin#custom-fields
PHPPro

ACF: Populate Select Choices from Post Categories

Dynamically fills an ACF select field named 'scseed_category_picker' with all registered post categories, keeping choices in sync automatically.

#acf#categories#custom-fields
PHP

ACF: Display Field Value via Shortcode

Registers a [scseed_acf_field name="field_name"] shortcode that outputs a single ACF field value, safely escaped for display.

#acf#custom-fields#display
PHP

ACF: Hide ACF Admin Menu for Non-Admins

Hides the ACF admin menu item from all users who do not have the manage_options capability, keeping the UI clean for editors.

#acf#admin#custom-fields
PHPPro

ACF: Set Google Maps API Key

Configures the Google Maps API key used by ACF map fields via a constant placeholder — replace the constant value with your real key.

#acf#custom-fields#google-maps
PHPPro

ACF: Register an Options Page

Registers a top-level ACF options page in the WordPress admin so site-wide settings can be managed through custom fields.

#acf#admin#custom-fields
PHPPro

Elementor: Register Custom Icon Library in the Icon Picker

Adds a custom icon font library tab to the Elementor icon picker so theme-specific icon sets appear alongside the built-in Font Awesome libraries.

#customization#editor#elementor
PHPPro

Elementor: Dequeue Assets on Non-Elementor Pages

Removes Elementor frontend CSS and JS from pages not built with Elementor, cutting page weight on standard theme pages.

#assets#dequeue#elementor
PHP

Elementor: Disable Font Awesome 4 Compatibility Shim

Prevents Elementor from loading the FA4 backward-compatibility shim, reducing page weight on sites that only use Font Awesome 5 or 6 icons.

#assets#elementor#font-awesome
PHPPro

Elementor: Enqueue Custom Stylesheet in the Elementor Preview

Injects a custom stylesheet into the Elementor live-preview iframe so design changes match the live site appearance in real time.

#css#editor#elementor
PHPPro

Elementor: Enqueue Custom Scripts in the Elementor Editor

Loads a theme stylesheet and script file inside the Elementor editor panel for adding editor-side UI enhancements or styling tweaks.

#admin#editor#elementor
PHP

Elementor: Wrap Elementor Frontend Content Output

Filters the final rendered Elementor page content to add a custom wrapper div, useful for scoped CSS or JavaScript targeting.

#content#elementor#filter
PHP

Elementor: Add Body Class on Elementor-Built Pages

Appends a has-elementor-page CSS class to the body tag on any singular page built with Elementor, enabling targeted stylesheet overrides.

#body-class#css#elementor
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