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.

PHPPro

Add a Custom Bulk Action to Post Lists

Registers a 'Set to Draft' bulk action on the Posts list screen so editors can unpublish many posts at once.

#admin#bulk-actions#editor
PHP

Add a Custom Admin Menu Link

Adds a top-level admin sidebar item that redirects to an external URL such as documentation or a project management tool.

#admin#menu#navigation
PHPPro

Require a Category Selection Before Publishing

Prevents posts from being published if they remain in only the default Uncategorized category, enforcing deliberate categorization.

#admin#editor#publishing
PHPPro

Require Minimum Word Count to Publish

Blocks publication of a post until its content reaches a configurable minimum word count (default 300 words).

#admin#content#editor
PHPPro

Require Featured Image Before Publishing

Prevents posts and pages from being published unless a featured image has been set, covering both Block and Classic editors.

#admin#editor#featured-image
PHP

Set Default Image Link to None on Insert

Prevents WordPress from automatically wrapping inserted images in anchor tags linking to the attachment page or file.

#admin#editor#images
PHP

Set Default Image Insert Size in Editor

Changes the default image size selected when inserting media into a post to 'large'.

#admin#editor#images
PHP

Change Editor Autosave Interval

Extends the Block Editor autosave interval to 2 minutes (default is 60 seconds) to reduce unnecessary revision noise.

#admin#autosave#editor
PHP

Disable Openverse Media in Block Editor

Removes the Openverse external image search tab from the Block Editor media panel.

#admin#editor#gutenberg
PHP

Disable Block Template Editor

Removes the template-editing option from the Block Editor so users cannot modify block templates.

#admin#block-editor#editor
PHP

Disable Full Site Editing

Hides the Site Editor menu entry and disables template-editing mode in the Block Editor.

#admin#editor#full-site-editing
PHPPro

Disable Code Editor in Block Editor for Non-Admins

Locks the HTML/Code editor view in Gutenberg to administrators only, preventing non-admins from switching to raw markup.

#admin#editor#gutenberg
PHP

Disable Block Editor Welcome Guide Popup

Suppresses the introductory welcome modal that appears the first time a user opens the Block Editor.

#admin#editor#gutenberg
PHP

Disable Block Editor Fullscreen Mode by Default

Opens the Block Editor in windowed mode instead of fullscreen for all users.

#admin#block-editor#editor
PHP

Disable Block Editor Site-Wide (Use Classic Editor)

Forces the Classic Editor for all post types by disabling the Block Editor globally.

#admin#block-editor#classic-editor
PHPPro

Add a Custom User Role

Registers a new WordPress user role with a defined set of capabilities, falling back gracefully if the role already exists.

#access-control#admin#capabilities
PHPPro

Hide a Taxonomy From Public and Admin UI

Makes an existing taxonomy internal-only by removing it from the admin menu, REST API, and frontend URLs while keeping the data intact.

#admin#cpt#taxonomy
PHP

Disable Default Categories and Tags Taxonomies

Unregisters the built-in Categories and Tags taxonomies from Posts for sites that use custom taxonomies exclusively.

#categories#cleanup#tags
PHP

Remove Posts Post Type From Admin

Hides the Posts menu item and removes Posts from the admin bar for non-admin users on sites that do not use the blog.

#admin#cleanup#menu
PHPPro

Add a Custom Meta Box and Save Field

Registers a meta box on the post edit screen with a sanitized text field that is saved and retrieved via the WordPress meta API.

#admin#cpt#custom-fields
PHPPro

Include a CPT in the Main Blog Loop

Merges a custom post type into the main blog archive and home feed query so its posts appear alongside standard posts.

#archive#cpt#loop
PHPPro

Make a CPT Sortable by Drag and Drop

Adds jQuery UI sortable drag-and-drop ordering to a custom post type list table and saves the manual order to post_menu_order.

#admin#cpt#drag-drop
PHP

Add Featured Image Support to All Post Types

Enables thumbnail (featured image) support on every registered public custom post type that does not already have it.

#admin#cpt#featured-image
PHP

Add Excerpt Support to Pages

Enables the Excerpt meta box on Pages so editors can write custom page descriptions used by themes and SEO plugins.

#admin#cpt#excerpt