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

Disable Specific REST API Routes

Removes the /wp/v2/users and single-user REST endpoints to prevent unauthenticated enumeration of user logins and IDs.

#access#rest-api#security
PHPPro

Add CORS Headers to REST API Responses

Adds Access-Control-Allow-Origin and related CORS headers to REST API responses so headless front ends on separate origins can make authenticated requests.

#cors#headless#rest-api
PHPPro

Register a Custom Read-Only REST Endpoint

Creates a public GET /wp-json/scseed/v1/site-info endpoint that returns the site name, URL, description, language, and timezone as JSON.

#endpoint#headless#json
PHPPro

Add Custom Post Meta Field to REST Response

Registers a custom _scseed_subtitle meta key on post objects in the REST API, exposing it for both reading and writing by authorised editors.

#custom-fields#meta#posts
PHP

Add Featured Image URL to Posts REST Response

Registers a featured_image_url field on the post REST object so headless themes can access the full-size image URL without an extra request.

#headless#images#posts
PHPPro

Restrict Plugin Activation to Super Admins on Multisite

Removes the activate_plugins capability from regular site admins on a multisite network so only super admins can activate or deactivate plugins.

#multisite#plugins#roles
PHPPro

Auto-Activate Plugins on New Multisite Sites

Automatically activates a predefined list of plugins on every newly created subsite in the network to enforce a consistent baseline setup.

#automation#multisite#network
PHPPro

Add Custom Column to Network Sites List

Inserts a "Last Post" column into the Network Admin Sites table showing the most recent published post date for each subsite.

#admin#multisite#network
PHPPro

Set Default Theme for New Multisite Sites

Automatically activates a specified theme on every newly provisioned subsite in a WordPress multisite network.

#automation#multisite#network
PHPPro

Allow Only Logged-In Users (Private Site Gate)

Redirects unauthenticated visitors to the login page for every front-end request, turning the site into a members-only experience.

#access#login#members
PHPPro

Custom Welcome Email to New Users

Sends a branded HTML welcome email to every new registrant with their login link, overriding the default WordPress notification.

#email#onboarding#registration
PHPPro

Auto-Login After Registration

Automatically authenticates a new user and redirects them to the site after they complete registration, removing the need to log in manually.

#login#registration#users
CSS

Remove Login Page Shake Animation

Disables the CSS shake animation applied to the login form when an incorrect password is entered, for a calmer error experience.

#animation#css#login
PHP

Add Logout Link to Navigation Menu

Appends a logout link (or a login link for guests) to the primary navigation menu, automatically using the correct URL and label based on auth state.

#login#menu#navigation
PHP

Disable Gravatar and Use Local Fallback Avatar

Prevents WordPress from requesting Gravatar images from external servers, returning a local placeholder for all users to improve privacy and load speed.

#avatars#performance#privacy
PHP

Set Custom Default Avatar

Registers a local image as a new default avatar option and forces it as the site default, replacing the generic mystery-person silhouette.

#avatars#customization#profile
PHP

Add Custom Links Below Login Form

Appends a Privacy Policy and Terms of Service link beneath the WordPress login form using the login_footer action.

#customization#links#login
PHP

Disable Login Page Language Switcher

Removes the language/locale dropdown displayed beneath the WordPress login form, keeping the page minimal for single-language sites.

#customization#language#login
PHP

Extend Login Session Duration

Increases the WordPress authentication cookie lifetime to 30 days for a normal session and one year when "Remember Me" is checked.

#cookies#login#session
PHP

Check Remember Me by Default on Login

Pre-checks the "Remember Me" checkbox on the WordPress login form using a small script injected into the login footer.

#login#session#users
PHP

Disable New User Notification Emails

Suppresses both the admin notification and the default welcome email sent to the registrant whenever a new account is created.

#email#notifications#registration
PHP

Set Default Role for New Registrations

Overrides the default role assigned to newly registered users, setting it to "subscriber" regardless of the value saved in Settings → General.

#access#registration#roles
PHP

Redirect Logged-In Users Away From Login Page

Sends already-authenticated visitors to the dashboard (admins) or homepage (others) when they attempt to load the login screen.

#login#redirect#users
PHP

Redirect Users After Logout

Redirects users to the site homepage instead of the login screen after they click Log Out.

#login#logout#redirect