Snippet library
PHP snippets for WordPress.
467 free & Pro snippets and modules. Copy-paste-ready, or import in one click with SnipCraft.
Add Featured Images to RSS Feed
Prepends the post's featured image to both the full-content and excerpt RSS feed items.
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.
Keep Sticky Posts on Archives
Reorders archive query results so that sticky posts always appear first on category, tag, and date archives.
Related Posts by Shared Tags
Appends a list of related posts based on shared tags after single post content.
Child Pages List Shortcode
Shortcode [scseed_child_pages] that lists the immediate sub-pages of the current (or a specified) page.
Recently Updated Posts Shortcode
Shortcode [scseed_recently_updated] that lists posts ordered by last-modified date.
Popular Posts by Views Shortcode
Tracks post view counts in meta and provides a [scseed_popular_posts] shortcode that outputs the most-viewed posts.
Random Posts Shortcode
Shortcode [scseed_random_posts] that outputs a randomised list of published posts.
"New" Badge for Recent Posts
Appends a "New" badge to post titles in list views for posts published within the last 7 days.
Show Modified Instead of Published Date
Replaces the displayed post date with the last-modified date on single posts.
Display Last Updated Date
Appends the post's last-modified date below the content on single posts.
Disable Comments Site-Wide
Completely disables WordPress comments: closes them on all post types, removes the Comments menu, hides the admin bar node, and suppresses existing comments.
Add Custom Post Type Count to At a Glance Widget
Appends a published-count entry for a custom post type (default: 'product') to the Dashboard At a Glance widget.
Restrict Media Library to Own Uploads
Limits non-administrator users to viewing and managing only their own uploaded media files in the Media Library.
Redirect to Live Post After Publishing
After a post is newly published the editor is redirected to the live post URL instead of remaining on the edit screen.
Add Settings Link to a Plugin on the Plugins Page
Prepends a Settings action link for a specific plugin on the Plugins admin list — update the plugin basename and settings URL as needed.
Duplicate Post Row Action
Adds a nonce-protected Duplicate row action to the Posts list that creates a draft copy including all post meta and taxonomy terms.
Custom Dashboard Welcome Widget
Registers a branded quick-start widget on the admin dashboard showing live post, page, and comment counts with action buttons.
Role-Based Login Redirect
Sends users to different URLs after login depending on their WordPress role, e.g. subscribers to /account/ and editors to the post list.
Track and Display Last Login in Users List
Records each user's last login timestamp and displays it as a sortable column in the Users admin list table.
Custom Login Logo, URL, and Title
Replaces the WordPress logo on the login page with the site's custom logo, linking back to the homepage.
Redirect Subscribers Away from wp-admin
Redirects logged-in users who lack editing capabilities to the homepage when they try to access wp-admin.
Remove Default Dashboard Widgets
Removes the Quick Draft, WordPress Events & News, and Activity widgets from the admin dashboard.
Custom WordPress Email From Name and Address
Changes the default WordPress email sender name and address to your site name and a noreply alias.