WP PowerSuite
150+ modules in one suite — toggle only what you need. Zero runtime cost for features you leave off.
See Plans
On This Page
v 1.0.0
Last updated: 16/03/2026

Code Snippet

Add and manage custom code snippets (HTML, CSS, JavaScript, PHP) with auto-insert in header, body, or footer, or use shortcodes to place them anywhere.

Overview

Code Snippet lets you add and manage custom code snippets (HTML, CSS, JavaScript, PHP) without editing theme files. Create snippets and assign them to locations: header, body, footer, or shortcode-only. Use shortcodes to place snippets anywhere. Supports conditional logic (e.g. frontend only, admin only, WooCommerce hooks). Snippets can be active or inactive. Revisions and safe mode for PHP snippets. A dedicated page under WP PowerSuite for managing all snippets.

Who is this for?
Developers and site owners who need to add tracking codes, custom scripts, or PHP snippets without editing theme files. Similar to WPCode or similar snippet plugins.

Features

Multiple Code Types
HTML, CSS, JavaScript, PHP. Each snippet has a type and location.
Locations
Header (wp_head), body (wp_body_open), footer (wp_footer), or shortcode only. PHP snippets can run in admin, frontend, or everywhere. WooCommerce hooks when WooCommerce is active.
Shortcode Placement
Use [wpps_snippet id="X"] to place a snippet anywhere. Works with any code type.
Active/Inactive
Toggle snippets without deleting. Inactive snippets don't run.
Revisions
Track changes to snippets. Restore previous versions if needed.
Safe Mode
PHP snippets can be run in safe mode to catch errors before affecting the site.

How It Works

1
Enable the Module
Go to WP PowerSuite, find "Code Snippet," and click the Enable button.
2
Create a Snippet
Go to WP PowerSuite → Code Snippet. Click "Add New." Choose type (HTML, CSS, JS, PHP), location, and enter your code. Save and activate.
3
Use It
Snippets with header/body/footer locations run automatically. Use [wpps_snippet id="X"] for shortcode placement.
Performance Note
Snippets are loaded from the database. Active snippets add hooks. Minimal overhead. PHP snippets run at their assigned priority. Use shortcode for snippets that don't need to run on every page.

Installation & Activation

1
Install WP PowerSuite
Make sure the WP PowerSuite plugin is installed and activated on your site.
2
Enable the Module
Go to the WP PowerSuite menu, find "Code Snippet" in the module list, and click the Enable button.
3
Configure Snippets
Go to WP PowerSuite → Code Snippet. Create and manage snippets. Use shortcodes where needed.
Requirements
PHP 8.1 or higher WordPress 6.0 or higher Permission to manage options (Administrator)

Use Cases

  • CodeInjection
    Add Google Analytics or other tracking codes
  • ScriptIntegration
    Inject custom CSS or JavaScript
  • SnippetExecution
    Run PHP snippets (e.g. disable features, add filters)
  • ShortcodeEmbedding
    Use shortcodes to place code in specific places

Frequently Asked Questions

Troubleshooting

  • Snippet not appearing
    Ensure the snippet is active. Check the location (header/body/footer vs shortcode). For shortcode, verify the ID. Clear cache if using a caching plugin.
  • PHP snippet causing errors
    Use safe mode to test. Check PHP syntax. Enable WP_DEBUG to see errors. Restore from revisions if needed.