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.

PHP

Display Last Updated Date

Appends the post's last-modified date below the content on single posts.

#content#dates#display
PHPPro

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.

#admin#cleanup#comments
PHPPro

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.

#admin#custom-post-types#dashboard
PHPPro

Restrict Media Library to Own Uploads

Limits non-administrator users to viewing and managing only their own uploaded media files in the Media Library.

#admin#media#permissions
PHPPro

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.

#admin#posts#redirects
PHPPro

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.

#admin#plugins#settings
PHPPro

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.

#admin#duplicating#posts
PHPPro

Custom Dashboard Welcome Widget

Registers a branded quick-start widget on the admin dashboard showing live post, page, and comment counts with action buttons.

#admin#branding#dashboard
PHPPro

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.

#login#redirects#roles
PHPPro

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.

#admin#columns#security
PHPPro

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.

#branding#customization#login
PHP

Redirect Subscribers Away from wp-admin

Redirects logged-in users who lack editing capabilities to the homepage when they try to access wp-admin.

#admin#roles#security
PHP

Remove Default Dashboard Widgets

Removes the Quick Draft, WordPress Events & News, and Activity widgets from the admin dashboard.

#admin#cleanup#dashboard
PHP

Custom WordPress Email From Name and Address

Changes the default WordPress email sender name and address to your site name and a noreply alias.

#admin#branding#email
PHP

Disable Author Archive Pages

301-redirects all author archive URLs to the homepage, effectively disabling them to reduce user enumeration exposure.

#authors#redirects#security
PHP

Set Default Admin List Screen Per-Page Count

Sets the default number of rows shown on admin list tables to 25 for users who have not yet changed the preference.

#admin#lists#pagination
PHP

Add Featured Image Column to Posts List

Inserts a thumbnail preview column before the Title column in the wp-admin Posts list table.

#admin#columns#featured-image
PHP

Add Custom Body Class on Login Page

Appends a custom CSS class to the body tag on wp-login.php for targeted login-page styling.

#branding#css#customization
PHP

Replace "Howdy" Greeting in Admin Bar

Swaps the "Howdy, Username" text in the admin bar with a plain "Hello, Username" for a more neutral tone.

#admin#admin-bar#branding
PHP

Hide Update Nag for Non-Admins

Removes the WordPress core update notification banner for users without the manage_options capability.

#admin#notices#roles
PHP

Remove WordPress Logo from Admin Bar

Removes the WordPress logo menu node from the admin toolbar for all users.

#admin#admin-bar#branding
PHP

Generic Login Error Message

Replaces specific login error messages with a generic one to prevent username and email enumeration.

#hardening#login#security
PHP

Hide Admin Bar for Non-Admins on Front End

Removes the front-end admin toolbar for logged-in users who do not have the manage_options capability.

#admin-bar#frontend#roles
PHP

Custom Admin Footer Text

Replaces the default 'Thank you for creating with WordPress' footer credit in wp-admin with your site name.

#admin#branding#customization