Snippet library
PHP snippets for WordPress.
467 free & Pro snippets and modules. Copy-paste-ready, or import in one click with SnipCraft.
Remove Admin Color Scheme Picker
Hides the color scheme picker from user profile pages to enforce a consistent admin theme.
Disable Site Health Widget and Page
Removes the Site Health dashboard widget and hides the Site Health submenu link from wp-admin.
Sort Plugins List Active First
Reorders the Plugins admin list so active plugins appear at the top, making status scanning faster.
Hide Admin Menu Items by Role
Removes specified top-level admin menu pages for non-administrator users to declutter their dashboard.
Reorder Admin Menu Items
Sets a custom top-level order for the WordPress admin navigation menu using the menu_order filter.
Add User Role Column to Users List
Appends a Role column to the Users list table for quick role visibility without opening each profile.
Add Registration Date Column to Users
Adds a sortable Registered date column to the Users list table formatted with the site date setting.
Add Image Dimensions Column to Media
Shows width × height in pixels for image attachments in a dedicated Media Library list column.
Add File Size Column to Media Library
Displays the file size of each attachment in a new column on the Media Library list view.
Add Last Modified Column to Posts
Appends a sortable Last Modified date column to the Posts list table in wp-admin.
Add Post and Page ID Column
Adds a numeric ID column to the Posts and Pages list tables so editors can quickly copy IDs.
Add Page Template Name as Body Class
Appends a tpl-{slug} CSS class to the body tag derived from the active page template filename, enabling per-template styling in the front-end stylesheet.
Restrict Block Editor to an Allowed Block List
Limits the block inserter on the "post" post type to a curated set of core blocks, preventing editors from using layout or advanced blocks that may break the design.
Disable Block Editor for Specific Post Types
Disables the Gutenberg block editor for the "landing_page" and "staff_profile" post types, falling back to the Classic Editor for those content types.
Log Failed Login Attempts to a Transient
Records each failed login with the attempted username, IP address, and timestamp into a daily transient, keeping the last 100 entries for admin review.
Email Admin on New User Registration
Sends the admin a plain-text email with the new user's login, email address, and a direct link to their profile whenever someone registers.
WP-Cron Job to Republish Stuck Scheduled Posts
Schedules an hourly cron event that finds future-dated posts whose publish time has passed and publishes them, fixing missed scheduled posts.
Scheduled Weekly Cleanup of Expired Transients
Registers a weekly WP-Cron event that deletes all expired non-autoload transients from the options table to reclaim database space.
REST Endpoint: Admin Site Statistics
Registers a GET /wp-json/scseed/v1/site-stats endpoint (admin-only) that returns published post counts per public post type, total users, and software versions.
Disable REST API Access for Non-Logged-In Users
Returns a 401 Unauthorized error for all REST API requests made by unauthenticated visitors, protecting data from public exposure.
Add Reading Time Field to Posts REST Response
Registers a reading_time_minutes field on the post REST object that returns the estimated read time based on a 200 words-per-minute reading speed.
REST Endpoint: Recent Posts by Type
Registers a GET /wp-json/scseed/v1/recent-posts endpoint that returns the most recent published posts for any public post type, with count and type query params.
Allow SVG Uploads with DOM Sanitization
Enables SVG file uploads and automatically sanitizes each uploaded SVG by stripping script elements, event-handler attributes, and javascript: href values via DOMDocument.
Register a Custom Block Category
Inserts a "My Custom Blocks" category at the top of the block inserter panel for grouping site-specific custom blocks.