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.

PHP

Remove Admin Color Scheme Picker

Hides the color scheme picker from user profile pages to enforce a consistent admin theme.

#admin#cleanup#color-scheme
PHP

Disable Site Health Widget and Page

Removes the Site Health dashboard widget and hides the Site Health submenu link from wp-admin.

#admin#cleanup#dashboard
PHP

Sort Plugins List Active First

Reorders the Plugins admin list so active plugins appear at the top, making status scanning faster.

#admin#list-table#plugins
PHPPro

Hide Admin Menu Items by Role

Removes specified top-level admin menu pages for non-administrator users to declutter their dashboard.

#access-control#admin#customization
PHPPro

Reorder Admin Menu Items

Sets a custom top-level order for the WordPress admin navigation menu using the menu_order filter.

#admin#customization#menu
PHP

Add User Role Column to Users List

Appends a Role column to the Users list table for quick role visibility without opening each profile.

#admin#columns#roles
PHP

Add Registration Date Column to Users

Adds a sortable Registered date column to the Users list table formatted with the site date setting.

#admin#columns#registration
PHP

Add Image Dimensions Column to Media

Shows width × height in pixels for image attachments in a dedicated Media Library list column.

#admin#columns#dimensions
PHP

Add File Size Column to Media Library

Displays the file size of each attachment in a new column on the Media Library list view.

#admin#columns#file-size
PHP

Add Last Modified Column to Posts

Appends a sortable Last Modified date column to the Posts list table in wp-admin.

#admin#columns#list-table
PHP

Add Post and Page ID Column

Adds a numeric ID column to the Posts and Pages list tables so editors can quickly copy IDs.

#admin#columns#list-table
PHPPro

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.

#css#customization#frontend
PHPPro

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.

#blocks#editor#gutenberg
PHPPro

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.

#classic-editor#editor#gutenberg
PHPPro

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.

#logging#login#security
PHPPro

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.

#email#notifications#registration
PHPPro

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.

#automation#cron#posts
PHPPro

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.

#cleanup#cron#performance
PHPPro

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.

#admin#monitoring#rest-api
PHPPro

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.

#access#authentication#rest-api
PHPPro

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.

#custom-fields#json#posts
PHPPro

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.

#endpoint#json#posts
PHPPro

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.

#media#sanitization#security
PHP

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.

#blocks#customization#editor