Snippet library
WordPress code snippets, ready to use.
707 free & Pro snippets and modules. Copy-paste-ready, or import in one click with SnipCraft.
Change Login URL Slug
Moves the login form to a custom URL slug and blocks direct access to wp-login.php to reduce credential-stuffing exposure.
Email-Code Two-Factor for Admins
After a successful password login, administrator accounts receive a one-time email code that must be entered before the session is granted.
Restrict Admin Access by Country
Geo-blocks wp-admin access, allowing only logins from a configurable list of country codes, with a transient-cached IP lookup.
Restrict wp-admin by IP Allowlist
Blocks access to the WordPress admin dashboard from any IP address not in the configured allowlist.
Auto-Logout Idle Users
Redirects logged-in users to the login page after 30 minutes of browser inactivity.
Lock Account After Failed Logins
Temporarily blocks a username/IP combination after a configurable number of failed logins and emails the site admin.
Enforce Strong Password Policy
Requires passwords to contain uppercase, lowercase, a digit, and a special character before the profile can be saved.
Force Minimum Password Length
Rejects passwords shorter than a configurable minimum when a user saves their profile.
Disable Application Passwords
Turns off WordPress's built-in application password feature to reduce the API attack surface.
Recent Posts With Thumbnails Shortcode
Shortcode [recent_posts_thumbs] that outputs a configurable list of recent posts with featured image thumbnails and dates.
Register a Custom Sidebar Widget Area
Registers a new named widget area that can be displayed anywhere via dynamic_sidebar() or a shortcode.
Disable Remote Pattern Directory
Prevents WordPress from loading block patterns from the remote WordPress.org pattern directory, improving editor load time.
Register a Custom Block Pattern
Registers a reusable block pattern category and a hero CTA layout pattern available in the block inserter.
Show Custom Fonts in Block Editor
Loads a custom font from Google Fonts into the block editor and applies it to the editor canvas to match frontend typography.
Register a Block Style Variation
Registers additional style variations for core blocks so editors can pick alternate visual treatments in the block toolbar.
Add Custom Editor Font Sizes
Defines a typographic scale in the block editor and disables arbitrary font-size input to keep sizing consistent.
Add Custom Editor Color Palette
Registers a brand color palette in the block editor and disables the free-form color picker to enforce consistency.
Disable Specific Gutenberg Blocks
Removes a configurable list of core blocks from the block inserter so editors cannot add them.
Enable Classic Widgets
Restores the legacy Widgets screen and Customizer widget panel, disabling the block-based widget editor.
Color-Code Post Status in List
Applies subtle background tints to draft, pending, scheduled, private, and trashed rows in the Posts list table.
Custom Admin Dashboard Notice
Displays a custom information notice on the Dashboard page for editors so they see a welcome message on login.
Hide Admin Notices for Non-Admins
Suppresses all admin notice banners for non-administrator users to keep the dashboard clean for clients.
Move Admin Bar to Bottom
Repositions the WordPress toolbar from the top of the viewport to the bottom using CSS overrides.
Hide Screen Options and Help Tabs
Removes the Screen Options dropdown and all Help tab panels from wp-admin for non-administrator users.