Documentation, Reference Materials, and Tutorials for WPCode
Would you like to know which snippet type to reach for before you paste in a single line of code?
In this guide, we’ll walk you through all eight WPCode snippet types and what each one changes in the snippet editor. All you need is the code you want to add and a few minutes to pick the right home for it.
Before you get started, make sure WPCode is installed and activated on your WordPress site.
WPCode asks you to choose a code type as the very first thing you do in a new snippet. That makes the picker the best place to see all eight side by side.
To get there, go to Code Snippets » + Add Snippet in your WordPress admin sidebar.

The Add Snippet screen opens on the Snippet Library tab. Hover over the Add Your Custom Code (New Snippet) card and click + Add Custom Snippet.

A blank snippet opens with the code type picker already showing. Each card names a type and describes what it is for. The card outlined in blue is the type you chose last.
Next, click the card for the type you need. The walkthrough below starts with HTML Snippet.

Each type gets its own section below, in the same order its card appears in the picker.
Every type saves to the same snippets list and shares the same insertion, conditional logic, and scheduling options. Three things change from type to type: the editor you get, how WPCode outputs your code, and which extra controls appear above the editor. In one case, the choice also changes which locations you can insert the snippet into.
If you already have your code in front of you, this list points you at the right section:
HTML snippets suit anything you copy and paste from another service, such as a tracking script, an ad tag, or a verification meta tag. WPCode outputs the code exactly as you wrote it. Whatever the provider gave you is what lands on the page.
The editor gives you line numbers and syntax highlighting. The type you picked is always shown in the Code Type dropdown above it.

Text snippets swap the code editor for the classic WordPress editor. They suit content you want to write and format rather than code you want to paste.
You get the familiar formatting toolbar, an Add Media button, and Visual and Code tabs. You can switch to markup whenever you need to.
WordPress adds paragraph formatting to the content when you save. Shortcodes from your other plugins are processed when the snippet runs. New to shortcodes? See What is Shortcode in WordPress? for a plain-English explanation.

Requirements: Blocks snippets are available in the paid versions of WPCode.
Blocks snippets let you build the snippet in the WordPress block editor. You can assemble a component from blocks instead of writing the markup by hand.
Choosing this type replaces the editor with an Edit with Block Editor button that loads the block canvas.

CSS snippets hold styles. WPCode wraps them in a style tag when it outputs them, which means you write the rules on their own without any surrounding markup. The editor switches to CSS highlighting when you pick this type.
CSS snippets also add a Live Preview button next to Save Snippet. Live Preview opens your site with the styles applied so you can see the result before you make the snippet live.

Requirements: SCSS snippets are available in the paid versions of WPCode.
SCSS snippets do the same job as CSS snippets, with SCSS syntax. You can use nesting and variables while you write.
WPCode compiles the SCSS to CSS when you save and outputs the compiled CSS in a style tag. Nothing extra runs in your visitors’ browsers.
SCSS snippets get the same Live Preview button as CSS snippets.
JavaScript snippets suit code you want to run in the browser. Write the JavaScript on its own, because WPCode wraps it in a script tag when it outputs it. If you paste in code that already has a script tag, WPCode removes it for you.
That last point matters when you are pasting a tag from another service. Those usually arrive with their own script tag already wrapped around them. In that case, choose HTML so the provider’s code goes out exactly as they gave it to you.
PHP snippets run on the server. That is what you want for anything that hooks into WordPress, changes how a page is built, or adds a function.
Write the PHP on its own, since WPCode strips the opening and closing PHP tags when you save. WPCode’s snippet generators produce PHP snippets when they add functionality, such as a custom post type or a scheduled task.
PHP is also the one type that reaches the PHP Snippets Only group in the location list. Those five locations run your code rather than printing it into the page. They are matched to the type that executes on the server.
A new PHP snippet also starts on a different location from the rest. It defaults to Run Everywhere, while the other seven types default to Site Wide Header. Our guide to snippet locations covers the full list.

Universal snippets let you write HTML and PHP together in one snippet, the same way a template file does. You start in HTML, drop into PHP where you need a value, and come back out again. This suits template-style layouts and shortcodes that need to output markup and run logic at the same time.
If you pick a type and then decide another one fits better, you do not need to start again. The Code Type dropdown above the code editor lists all eight types.
To switch, choose the type you want from the Code Type dropdown. Your code stays in the editor while you switch.

That’s it! You now know what each WPCode snippet type does and which one fits the code you have.
Next, take a look at our guide to snippet locations to choose exactly where on your site the snippet runs.
Below, we’ve answered some of the most common questions about WPCode snippet types.
Yes. Open the snippet and pick a different type from the Code Type dropdown above the editor. Then click Save Snippet. WPCode stores whichever type is selected each time you save.
Blocks and SCSS. In the free version, their cards in the picker are labeled Blocks Snippet (PRO) and SCSS Snippet (PRO).
No. WPCode adds the script tag when it outputs a JavaScript snippet. If you paste code that already has one, WPCode removes it when you save.
No. WPCode removes a leading opening tag and a trailing closing tag when you save. You can paste code either way.
WPCode replaces smart tags in HTML, Text, JavaScript, and Universal snippets. If your snippet needs a value such as the current post title or the visitor’s first name, pick one of those four types. Smart tags need a paid version of WPCode.
Both run PHP on the server. A PHP snippet expects PHP and nothing else, while a Universal snippet expects markup with PHP mixed into it, like a template file. One other difference matters when you choose: the five locations in the PHP Snippets Only group are available to PHP snippets. Reach for PHP when you need one of those.
Future-proof your website with WPCode Snippets and improve the way you manage code across all your websites.