Woody Code Snippets - Settings Reference
Woody Code Snippets lets you insert and manage PHP, HTML, CSS, JavaScript, text, and ad snippets on your WordPress site with conditional visibility rules, automatic placement, and WooCommerce integration. You can find the plugin settings under Woody snippets > Settings in the WordPress admin sidebar.
General
Auto-activate New Snippets
When enabled, every snippet you create or update is automatically set to active. When disabled, new snippets start in an inactive state and you must manually activate each one before it takes effect on your site. You would turn this off if you prefer to review and test snippets before they go live. Enabled by default.
Preserve Special Characters
When enabled, the plugin preserves HTML entities in your snippet content without converting them. Turn this on if your snippets contain special characters or HTML entities (such as &, <, or ©) that are being incorrectly decoded when displayed on the front end. Disabled by default.
Execute Shortcodes in Snippets
When enabled, the plugin processes any shortcodes embedded inside your snippets. Turn this on if you need to include shortcodes from other plugins (for example, a contact form shortcode) within a text or ad snippet. If you do not use shortcodes inside snippets, leave this off to avoid unnecessary processing. Disabled by default.
Enable Error Email Notifications
When enabled, the plugin sends email notifications when a snippet causes an error. This is useful for catching problems with PHP snippets that may fail silently on the front end. Enabling this setting reveals the Error Notification Email field. Disabled by default.
Error Notification Email
The email address that receives snippet error notifications. Defaults to the site admin email. This field only appears when Enable Error Email Notifications is turned on.
Delete All Data on Uninstall
When enabled, the plugin removes all of its data — including every snippet, setting, and associated post meta — when you uninstall (delete) the plugin from the Plugins page. Leave this off if you plan to reinstall the plugin later and want to keep your snippets. Disabled by default.
Code Editor
Code Style
Choose a color theme for the code editor used when editing PHP, CSS, JavaScript, HTML, and Universal snippets. The dropdown lists all available CodeMirror themes. The default theme uses a light background. Change this if you prefer a dark theme or a specific color scheme for readability. This setting does not affect Text or Ad snippet editors, which use the WordPress visual editor.
Indent With Tabs
When enabled, pressing the Tab key inserts a tab character instead of spaces. When disabled, the editor inserts spaces. Use whichever convention matches your coding style. Disabled by default (spaces are used).
Tab Size
Controls how many spaces a single Tab key press inserts. Accepts a value between 1 and 12. Only applies when Indent With Tabs is disabled. The default is 4.
Indent Unit
Controls the number of spaces used for each level of indentation in the code editor, such as when the editor auto-indents a new line inside a block. Accepts a value between 1 and 12. The default is 4.
Wrap Lines
When enabled, long lines of code wrap to fit the editor width instead of requiring horizontal scrolling. Turn this off if you prefer to see each line on a single row with a horizontal scrollbar. Enabled by default.
Line Numbers
When enabled, line numbers appear in the left gutter of the code editor. Turn this off if you find line numbers distracting. Enabled by default.
Auto Close Brackets
When enabled, the editor automatically inserts closing brackets, parentheses, and quotes when you type the opening character. Turn this off if auto-closing interferes with your editing workflow. Enabled by default.
Highlight Selection Matches
When enabled, selecting a word or token in the code editor highlights all other occurrences of that same text. This is helpful for quickly seeing where a variable or function name is used within your snippet. Disabled by default.
Geolocation
This tab only appears when the Woody Code Snippets Premium add-on is active.
IPHub API Key
Enter your IPHub API key to enable IP-based geolocation. The plugin uses this key to look up a visitor's country from their IP address, which powers the User country display condition. You can sign up for a free IPHub plan to get an API key. Without a valid key, the User country condition in the Display Conditions panel will not work. This setting is Pro only.
Import
The Import tab lets you upload a previously exported snippets file (JSON or ZIP format) to restore or migrate snippets between sites.
Duplicate Action
Controls what happens when an imported snippet has the same title as an existing snippet on your site. The options are:
- Ignore — imports the snippet as a new item regardless of duplicates
- Replace — overwrites the existing snippet with the imported version
- Skip — skips the imported snippet and keeps the existing one
Export
The Export tab lets you download your snippets as a file for backup or migration.
Status
Filter which snippets to include in the export by their activation status. The options are All, Active, and Inactive.
Types
Filter which snippet types to include in the export. You can select one or more types (PHP, Text, Universal, CSS, JavaScript, HTML, Ad). If you leave this empty, all types are included.
Tags
Filter which snippets to include based on their assigned tags. If you leave this empty, snippets with any tag (or no tag) are included.
Snippet Editor Settings
When you create or edit a snippet under Woody snippets, the editor screen contains several settings panels in addition to the code/content editor itself.
Add Snippet (Snippet Type Selection)
When you click + Add Snippet, you choose one of seven snippet types. The type determines which editor and which options are available.
PHP Snippet
Execute PHP code on your site. Register functions, hooks, and global variables. Think of it as a virtual functions.php file. PHP snippets use the code editor and support Run everywhere or shortcode-based execution.
Text Snippet
Insert formatted text content including quotes, paragraphs, tables, and media files. Supports shortcodes from other plugins. Text snippets use the WordPress visual editor and support automatic insertion or shortcode-based placement.
Universal Snippet
Insert any combination of PHP, HTML, JavaScript, and CSS code. Perfect for ads, analytics, embeds, and complex scenarios. Universal snippets use the code editor and support automatic insertion or shortcode-based execution.
CSS Snippet
Add custom CSS styles to your site. Modify appearance and layout without editing theme files. CSS snippets use the code editor and can be loaded as an external file or inline.
JavaScript Snippet
Add custom JavaScript to your site. Ideal for analytics, interactive features, and third-party integrations. JavaScript snippets use the code editor and can be loaded as an external file or inline.
HTML Snippet
Insert custom HTML markup anywhere on your site. Add structured content and layout elements. HTML snippets use the code editor and support automatic insertion or shortcode-based placement.
Ad Snippet
Insert advertisement code and banners. Manage ad placements with ease across your site. Ad snippets use the WordPress visual editor and support automatic insertion or shortcode-based placement.
General Options
Snippet Scope
Controls where the snippet executes on your site.
For PHP snippets the options are:
- Run everywhere — the snippet runs on every page load, similar to code in functions.php
- Where there is a shortcode — the snippet only runs where you place its shortcode
For all other snippet types the options are:
- Automatic insertion — the snippet is inserted at the location you choose in the Location dropdown
- Where there is a shortcode — the snippet is inserted only where you place its shortcode
Custom Shortcode Name
When Snippet Scope is set to "Where there is a shortcode", you can enter a custom name for the shortcode (for example, soccer_match_date to use [soccer_match_date] instead of the default [woody-snippet id="123"]). The name can only contain letters, numbers, underscores, and hyphens. If the name conflicts with an existing shortcode, the plugin appends a number to make it unique. This setting is Pro only.
Location
When Snippet Scope is set to "Automatic insertion" (non-PHP snippet types only), this dropdown controls exactly where the snippet appears on your site. Locations are grouped as follows:
Everywhere
This group does not appear for Text or Ad snippet types.
- Header — places the snippet in the source code before
</head>. - Footer — places the snippet in the source code before
</body>.
Posts, Pages, Custom post types
- Insert Before Post — places the snippet before the title of the post or page.
- Insert Before Content — places the snippet before the content of the post or page.
- Insert Before Paragraph — places the snippet before a specific paragraph number. When selected, an additional number field appears where you enter the paragraph number.
- Insert After Paragraph — places the snippet after a specific paragraph number. When selected, an additional number field appears where you enter the paragraph number.
- Insert After Content — places the snippet after the content of the post or page.
- Insert After Post — places the snippet at the very end of the post or page.
Categories, Archives, Tags, Taxonomies
- Insert Before Excerpt — places the snippet before the excerpt of a post in an archive listing.
- Insert After Excerpt — places the snippet after the excerpt of a post in an archive listing.
- Between Posts — places the snippet between each post in an archive listing.
- Before post — places the snippet before a specific post number in the listing. When selected, an additional number field appears.
- After post — places the snippet after a specific post number in the listing. When selected, an additional number field appears.
WooCommerce Locations
This group only appears when WooCommerce is installed. The WooCommerce locations are disabled (greyed out) unless both the Premium add-on and WooCommerce are active.
- Before the list of products — on the shop page, before the product grid or list.
- After the list of products — on the shop page, after the product grid or list.
- Before a single product — on a product page, before the entire product section.
- After a single product — on a product page, after the entire product section.
- Before a single product summary — on a product page, before the product details area (image, title, price, description).
- After a single product summary — on a product page, after the product details area.
- After a product title — on a product page, immediately after the product title.
- After a product price — on a product page, immediately after the product price.
- After a product excerpt — on a product page, immediately after the product short description.
Custom Action Hook
This group only appears if a theme or another plugin registers custom locations via the wbcr/woody/add_custom_location filter.
Linking Type
For CSS and JavaScript snippets only. Controls how the snippet is loaded on the front end. When set to "external", the snippet is served as a separate CSS or JS file with its own URL. This is the default and is generally better for caching. The alternative loads the snippet inline in the page source.
Description
A free-text area where you can describe what the snippet does. This is for your own reference and does not appear on the front end.
Tags
Assign tags to organize and filter your snippets. Tags appear in the snippet list view and can be used to filter exports. This field does not appear for Text or Ad snippet types, which use the WordPress visual editor.
WPML Language
This field only appears when the WPML plugin is active. It lets you restrict the snippet to run only when the site is viewed in the selected language. Leave it empty to run the snippet in all languages.
Insert WordPress Variables
This button only appears when editing a Text or Ad snippet. Requires the Premium add-on.
The "Insert WordPress Variables" button above the editor opens a dropdown menu of dynamic placeholders you can insert into your content. When the snippet runs on the front end, each placeholder is replaced with the corresponding live value. The available variable groups are:
WordPress information
Post URL, Post title, Post short URL, Post ID, Post featured image URL, Post excerpt, Post author, Post date, Post modified date, Post comments count, Post slug, Site title, Site description, Site URL, WordPress URL, Site character set, WordPress version, Active theme's stylesheet URL, Active theme's directory, Atom feed URL, RSS 2.0 feed URL.
Date parameters
Day, Day - leading zeros, Day - words - short form, Day - words - full form, Month, Month - leading zeros, Month - words - short form, Month - words - full form, Year, Year - 2-digit.
Custom Fields
Enter a custom field name to insert its value from the current post. Only letters, numbers, underscores, and hyphens are allowed in the field name. Useful for displaying Advanced Custom Fields (ACF) or other custom meta values inside your text or ad snippets.
Display Conditions
This panel appears for all snippet types except PHP.
Display Conditions let you show or hide a snippet based on rules about who is viewing the page and where. At the top of the panel you choose either Display If (show the snippet only when conditions are met) or Hide If (hide the snippet when conditions are met).
You can build multiple condition groups. Within a single group, all conditions must be true (AND logic). Between groups, only one group needs to be true (OR logic). Each condition row lets you pick a parameter, an operator (such as Equals, Not Equals, Contains, Greater Than, Less Than, Between), and a value.
User
Role
Match the WordPress role of the visitor. The dropdown lists all roles registered on your site plus "Guest" for logged-out visitors.
Registration Date
Match the date the visitor's WordPress account was registered. For unregistered (guest) users, the registration date is treated as 1 January 1970. Supports operators like Equals, Younger, Older, and Between.
Cookie Name
Check whether the visitor's browser has a cookie with a specific name. Only the Equals and Not Equals operators are available. Useful for targeting visitors who have been flagged by other plugins or scripts via cookies.
Location
Page URL
Match the URL of the page the visitor is currently viewing. Supports Equals, Not Equals, Contains, and Not Contain operators. Useful for targeting or excluding specific URLs.
Current Referrer
Match the referrer URL that brought the visitor to the current page. Supports the same text operators as Page URL. Useful for showing different content to visitors arriving from specific sources.
Post type
Match the WordPress post type of the current page (post, page, product, or any custom post type registered on your site).
Category/Tag Archive Page
Match a specific taxonomy archive page. For example, you can target the archive page for a particular category or tag.
Categories or Tags assigned to this page
Match based on the categories or tags assigned to the current post or page, rather than the archive page itself.
Page
Select a specific page from a searchable dropdown. Useful for targeting a single known page by name rather than by URL pattern.
Technology (Pro)
In the free version these conditions appear greyed out. They become functional when the Premium add-on is active.
Ad Blocker
Detect whether the visitor is using an ad blocker. Choose Yes or No. You might use this to show an alternative message to visitors blocking ads. This setting is Pro only.
Browser
Target visitors using a specific browser. The dropdown includes: Google Chrome, Chrome Mobile, Chromium, Android Browser, Firefox, Firefox Mobile, Opera, Opera Mobile, Opera Mini, Yandex Browser, Safari, Mobile Safari, MSIE, MSIE Mobile, UCWEB, Samsung Internet, and Other. This setting is Pro only.
Use cookie
Check whether the visitor's browser has cookies enabled. Choose Yes or No. This setting is Pro only.
Use javascript
Check whether the visitor's browser has JavaScript enabled. Choose Yes or No. This setting is Pro only.
Operating system
Target visitors by operating system. The dropdown includes: Windows, macOS, GNU/Linux, Android, ChromeOS, and Other with Java ME. This setting is Pro only.
Device type
Target visitors by device category. The dropdown includes: Mobile, Tablet, Phone, and Desktop. "Mobile" matches any mobile device, while "Phone" is more specific to phone-sized devices. This setting is Pro only.
Audience (Pro)
In the free version these conditions appear greyed out. They become functional when the Premium add-on is active.
User country
Target visitors by geographic location. The dropdown lists countries by name. This condition requires a valid IPHub API Key configured in the Geolocation settings tab. Without the API key, country detection will not work. This setting is Pro only.
Viewing depth
Target visitors based on the number of pages they have viewed in the current session. For example, show a snippet only to visitors who have viewed at least 3 pages. The plugin tracks page views using a cookie. This setting is Pro only.
Date Range
Show or hide a snippet during a specific date range. You pick a start date and end date, and the snippet only displays (or hides) while the current date falls within that window. Useful for time-limited promotions or seasonal content. This setting is Pro only.
Total Sessions
Target visitors based on the total number of sessions (visits) they have made to your site. The plugin tracks visit counts using a cookie with a two-month expiration. For example, you could show a special offer only to returning visitors with 3 or more sessions. This setting is Pro only.
Sync to Cloud Library
This sidebar panel shows the cloud sync status for the current snippet and provides a "Sync to Cloud" button. Cloud sync requires an active Premium license. Without a license, the panel displays an upgrade prompt. This feature is Pro only.
Code Revisions
This panel shows a table of saved revisions for the current snippet, displaying each revision's date, author, and action buttons. You can restore a previous revision to revert the snippet's code or content, or delete revisions you no longer need. The most recent 10 revisions are shown. You can click a revision to open a side-by-side diff view comparing any two revisions with syntax highlighting.
