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.

PHPPro

Defer Non-Critical CSS Loading

Converts specified stylesheet handles to rel="preload" links with an onload swap, removing them from the render-blocking path.

#css#optimization#performance
PHPPro

Minify HTML Output

Strips unnecessary whitespace and blank lines from the HTML response to reduce page size, preserving pre/script/style/textarea content verbatim.

#html#minify#optimization
PHPPro

Disable WP-Cron and Use a Server Cron

Prevents WordPress from spawning its built-in cron on every page load and includes setup notes for a real server cron job.

#optimization#performance#scheduling
PHPPro

Add a Custom Field Column to a Post List

Adds a sortable meta-value column to the admin post list table for any post type and meta key.

#admin#column#cpt
PHP

Display Current Post's Taxonomy Terms via Shortcode

Shortcode [post_terms taxonomy="category"] lists the terms of any taxonomy assigned to the current post.

#cpt#display#shortcode
PHPPro

Make a Taxonomy Single-Select with Radio Buttons

Replaces the default taxonomy checkbox meta box with a radio-button list that enforces single-term selection.

#admin-ui#cpt#metabox
PHPPro

Register a Custom Post Status

Registers an 'Archived' post status for posts and pages, and adds it to the Classic Editor status dropdown.

#admin#cpt#custom-status
PHPPro

Add rel="sponsored" to Affiliate Links

Rewrites outbound links with the CSS class 'affiliate' or matching configured domains to carry rel="sponsored noopener".

#affiliate#content#links
CSS

CSS Drop Cap on the First Paragraph

Applies a decorative large drop cap to the first letter of the opening paragraph on single posts and pages.

#content#css#drop-cap
PHP

Display Post Word Count Shortcode

Shortcode [word_count] displays the total word count of the current or any specified post.

#display#post#shortcode
PHP

Formatted Date and Time Shortcode

Shortcode [current_date] outputs the current date/time in the site's timezone using any PHP date format.

#date#display#dynamic
PHP

Display a Custom Field Value via Shortcode

Shortcode [custom_field key="field_name"] outputs the value of any post meta field inline.

#content#custom-field#display
PHPPro

Auto-Link Keywords to Internal Pages

Automatically hyperlinks the first occurrence of configured keywords to their target URLs in post content.

#content#internal-links#keywords
PHPPro

Auto-Insert Affiliate Disclosure on Posts

Prepends a compliance disclosure notice to any post tagged with the 'affiliate' tag.

#affiliate#compliance#content
PHPPro

Add Anchor Links to Headings Automatically

Adds a clickable # anchor link beside every h2–h4 heading in post content for easy linking.

#anchor#content#headings
PHP

Auto-Generate Excerpt from Post Content

Generates a trimmed excerpt from the post body when no manual excerpt has been written.

#auto#content#display
PHP

Show Post Count in Category and Tag Titles

Appends the post count in parentheses to category, tag, and custom taxonomy archive titles.

#archive#category#display
PHP

Display Archive and Term Description on Archives

Outputs the term or author description block above the post list on archive pages.

#archive#category#description
PHPPro

Exclude a Category from the Blog Homepage Loop

Removes a specified category from the main blog and front-page feed using pre_get_posts.

#category#exclude#homepage
PHPPro

Insert Content After the Last Paragraph

Injects a configurable CTA block immediately after the last paragraph on single posts.

#content#conversion#cta
PHP

Show Featured Image in Archive Post Lists

Prepends the post thumbnail to excerpts on archive, category, tag, and search results pages.

#archive#display#excerpt
PHP

Show Both Published and Modified Dates

Appends both the original publish date and the last-modified date below single-post content.

#content#dates#display
PHPPro

Expose Nav Menus via the REST API

Registers a GET /wp-json/scseed/v1/menu?location=primary endpoint that returns the items of a registered navigation menu.

#api#headless#menus
PHPPro

Add a Custom Field to the Users REST Response

Exposes a custom user meta field (job_title) in the WP REST API users endpoint with read and write support.

#api#headless#rest-api