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

Notify Post Author of Comments

Ensures the original post author always receives a comment notification email, even when the admin and author share an email address.

#authors#comments#email
PHP

Hold Comments With Many Links

Automatically queues comments for moderation when they contain more than a configurable number of hyperlinks.

#comments#moderation#security
PHP

Set Min/Max Comment Length

Rejects comment submissions that are shorter than a minimum or longer than a maximum character count.

#comments#content#moderation
JavaScriptPro

Auto-Collapse Long Comments

Collapses comment bodies taller than a threshold with an animated Read more / Read less toggle.

#accessibility#comments#frontend
JavaScriptPro

Comment Character Count and Limit

Displays a live character countdown on the comment textarea and blocks submission when the limit is exceeded.

#comments#forms#frontend
PHP

Nofollow Comment Author Links

Ensures all comment author anchor tags carry rel="nofollow ugc" to prevent link-spam SEO benefit.

#comments#links#security
PHP

Remove URL Field from Comment Form

Removes the website URL field from the default WordPress comment form to reduce spam.

#comments#forms#frontend
PHPPro

Disable Comments per Post Type

Removes comment support and meta boxes for a configurable list of post types, and gates the comments_open filter to match.

#admin#comments#moderation
PHP

Disable Comments on Attachments

Prevents comments and pings from being opened on media attachment posts.

#attachments#comments#media
PHP

Close Comments on Old Posts

Programmatically closes comments and pings on posts older than a configurable number of days.

#comments#content#moderation
PHPPro

Insert Ad/CTA After First Paragraph

Injects a customisable call-to-action block immediately after the first paragraph of single post content.

#ads#content#cta
PHP

Exclude Pages/Posts from Search

Removes specific post IDs and/or post types from the front-end search results query.

#content#filtering#frontend
PHP

Exclude Categories from RSS Feed

Removes posts from specified categories from appearing in the site's RSS feed.

#categories#content#feed
PHP

Delay Posts in RSS Feed

Withholds recently published posts from the RSS feed for a configurable number of hours to discourage content scraping.

#content#feed#rss
PHP

Add Featured Images to RSS Feed

Prepends the post's featured image to both the full-content and excerpt RSS feed items.

#content#feed#images
PHP

Add Slug and Category Body Classes

Adds the current page slug and post category slugs as extra CSS body classes for precise per-page styling.

#body-class#css#display
PHPPro

Keep Sticky Posts on Archives

Reorders archive query results so that sticky posts always appear first on category, tag, and date archives.

#archives#display#frontend
PHPPro

Related Posts by Shared Tags

Appends a list of related posts based on shared tags after single post content.

#content#engagement#posts
PHP

Child Pages List Shortcode

Shortcode [scseed_child_pages] that lists the immediate sub-pages of the current (or a specified) page.

#display#hierarchy#navigation
PHP

Recently Updated Posts Shortcode

Shortcode [scseed_recently_updated] that lists posts ordered by last-modified date.

#content#dates#display
PHPPro

Popular Posts by Views Shortcode

Tracks post view counts in meta and provides a [scseed_popular_posts] shortcode that outputs the most-viewed posts.

#analytics#popular#posts
PHP

Random Posts Shortcode

Shortcode [scseed_random_posts] that outputs a randomised list of published posts.

#content#display#posts
PHP

"New" Badge for Recent Posts

Appends a "New" badge to post titles in list views for posts published within the last 7 days.

#content#display#frontend
PHP

Show Modified Instead of Published Date

Replaces the displayed post date with the last-modified date on single posts.

#content#dates#display