---
title: WPCode Snippets
canonical_url: https://lolacore.com/wpcode-snippets/
last_updated: 2026-05-08T19:36:11+00:00
plugin_version: 1.2.1
---

# WPCode Snippets

## How to Use WPCode Snippets

WPCode is a powerful WordPress plugin that allows you to add custom code snippets to your site without editing your theme's functions.php file. This makes it easier to manage and organize your custom code.

## Adding a New Snippet

1. Go to **WPCode** → **Add Snippet** in your WordPress admin.
2. Choose a snippet type (PHP, JavaScript, CSS, HTML, or Text).
3. Give your snippet a title.
4. Paste your code into the code editor.
5. Configure the insertion method (Auto Insert, Shortcode, or Block).
6. Set the location (Frontend, Admin, or Both).
7. Click **Save Snippet** and toggle the switch to **Active**.

## Snippet Types

- **PHP Snippets** – For custom PHP functions and modifications.
- **JavaScript Snippets** – For adding custom JavaScript code.
- **CSS Snippets** – For adding custom CSS styles.
- **HTML Snippets** – For adding custom HTML content.
- **Text Snippets** – For adding plain text or shortcodes.

## Insertion Methods

- **Auto Insert** – The snippet runs automatically on every page load.
- **Shortcode** – Use a shortcode to insert the snippet anywhere on your site.
- **Block** – Use a Gutenberg block to insert the snippet.

## Location Settings

- **Frontend** – The snippet runs on the frontend of your site.
- **Admin** – The snippet runs in the WordPress admin area.
- **Both** – The snippet runs on both frontend and admin.

## Conditional Logic

WPCode allows you to set conditional logic for your snippets. You can choose to display snippets based on:

- Page type (home, single post, page, archive, etc.)
- User role (admin, editor, subscriber, etc.)
- Custom conditions (URL, referrer, device type, etc.)

## Code Revisions

WPCode keeps a history of all changes made to your snippets. You can view and restore previous versions of any snippet.

## Snippet Library

WPCode includes a built-in library of pre-made snippets. You can browse and install snippets for common tasks like:

- Disabling the admin bar
- Adding custom login styles
- Removing WordPress version numbers
- Adding Google Analytics tracking code

## Troubleshooting

If a snippet causes an error, WPCode will automatically disable it and display an error message. You can then edit or delete the problematic snippet.

## Best Practices

- Always test snippets on a staging site first.
- Use descriptive titles for your snippets.
- Add comments to your code for clarity.
- Keep snippets short and focused on a single task.
- Regularly review and clean up unused snippets.