Snippet library
PHP snippets for WordPress.
467 free & Pro snippets and modules. Copy-paste-ready, or import in one click with SnipCraft.
WooCommerce GA4 Purchase Event
Sends a GA4 Measurement Protocol purchase event server-side when a WooCommerce order status changes to completed, capturing transaction ID, revenue, tax, shipping, and line items.
SEO Breadcrumbs Shortcode
Registers a [scseed_breadcrumbs] shortcode that renders a semantic nav breadcrumb trail with home link, optional category, and current page — no plugin required.
Insert Header and Footer Code
Provides two configurable injection points — wp_head and wp_footer — so you can paste any scripts or markup into every page without editing theme files.
Add Custom Meta Tag to Head
Outputs one or more custom name or property meta tags into the page head; edit the array to add or remove tags without touching theme files.
Add Site Verification Meta Tags
Adds Google Search Console, Bing Webmaster Tools, Yandex, and Pinterest domain verification meta tags to every page head; leave any value empty to skip that provider.
Add hreflang Tags for Translations
Outputs hreflang alternate link tags for multilingual sites using WPML or Polylang, with a single-language self-referencing fallback when neither plugin is active.
Set Meta Description from Excerpt
Automatically outputs a meta description tag using the post excerpt, or falls back to a trimmed plaintext snippet from the post content on singular pages.
Noindex Specific Pages by ID
Adds a noindex,follow robots meta tag to specific pages or posts identified by their numeric ID, without touching any other URLs.
Noindex Search, Author, Paginated
Adds a noindex,follow robots meta tag to search results, author archives, and paginated non-singular pages to prevent thin-content indexing.
Set Canonical Ignoring Query Strings
Replaces WordPress's default canonical link with a query-string-stripped version so paginated/filtered URLs don't compete for indexing.
Add Author/Person Schema
Outputs a Person schema.org JSON-LD block on author archive pages with name, URL, bio, and optional Twitter/social sameAs link for author entity markup.
Auto-Generate BreadcrumbList JSON-LD
Automatically builds and outputs a BreadcrumbList schema.org JSON-LD block on single posts, category archives, and taxonomy pages for Google breadcrumb rich results.
Add LocalBusiness Schema
Injects a LocalBusiness schema.org JSON-LD block on the homepage with your business name, address, geo-coordinates, hours, phone, and price range.
Add WebSite Schema with Search Box
Outputs a WebSite schema.org JSON-LD block with a SearchAction sitelinks searchbox so Google can surface a search field directly in results.
Add Organization Schema JSON-LD
Outputs an Organization schema.org JSON-LD block on the homepage with your site name, URL, logo, contact details, and social profile links.
Add Article Schema JSON-LD
Injects an Article schema.org JSON-LD block into single post pages with headline, description, dates, author, and featured image for Google rich results.
Add Twitter Card Meta Tags
Outputs twitter:card, twitter:title, twitter:description, and twitter:image meta tags on singular posts so X/Twitter renders rich preview cards.
Add Open Graph Meta Tags
Outputs og:type, og:title, og:description, og:url, og:site_name, and og:image meta tags for singular posts and the homepage to enable rich social link previews.
Conditionally Remove jQuery Frontend
Dequeues jQuery and jquery-migrate on the frontend on simple page types where no enqueued scripts depend on it, reducing page weight.
Disable Block Directory Requests
Removes the block directory feature from the block editor, preventing outbound HTTP requests to the WordPress.org block directory while editing.
Change Trash Auto-Empty Days
Overrides the number of days WordPress waits before permanently deleting trashed posts (default is 30 days).
Disable Core WordPress Sitemaps
Turns off the built-in WordPress XML sitemap feature when an SEO plugin already generates its own sitemap.
Prevent Loading Translation Files
Blocks specified plugins from loading their .mo translation files when the site locale is English, eliminating unnecessary disk reads.
Defer or Async Scripts by Handle
Adds defer or async attributes to specific registered script handles so they do not block HTML parsing.