> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinedigital.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Perfmatters Enhancer

> A WordPress plugin that improves how you manage and what you can do with code snippets within Perfmatters.

## Requirements

* WordPress 6.9+
* PHP 8.1+
* [Perfmatters](https://influencewp.com/deal/performance-optimization/perfmatters/)

## Installation

1. Install and activate **Perfmatters**.
2. Download the latest **Perfmatters Enhancer** version from [your Pine Digital account](https://pinedigital.co/account/downloads).
3. In WordPress: **Plugins → Add New → Upload Plugin**, upload **Perfmatters Enhancer**, and **activate it**.

## Features

### Code Snippet Admin

* **Location Column:** See where each snippet runs at a glance in the snippets list (sortable).
* **Bulk Location Editing**: Change the run location for multiple snippets at once using the bulk actions bar.
* **Snippet Duplication**: Duplicate one or many snippets from the list (row action or bulk button). Copies are created inactive with the same code, location, and conditions.
* **Condition logic (OR / AND)**: Control how **Include** rules, **Exclude** rules, and user conditions combine on the single-snippet editor.

#### **Location Column**

For your convenience, the snippets table now includes a **Location** column showing where each snippet runs. Click the column header to sort by location.

Supported locations match Perfmatters (e.g., Frontend Header, Frontend Footer, Admin Header, Admin Footer, plus PHP and HTML-specific options).

#### **Bulk Location Editing**

1. Select snippets using Perfmatters’ checkboxes (same as bulk Activate/Delete).
2. Use **Change Location To** in the bulk actions bar, pick a location, and click **Apply to Selected**.

The location dropdown shows only the options that Perfmatters supports for the selected snippet types (the same rules apply as in the single-snippet editor). Select snippets first; mixed types show only locations valid for all selected types.

#### **Snippet Duplication**

Duplicate snippets from the Perfmatters snippets list in two ways:

1. **Row action** — Click **Duplicate** under a snippet name (next to Edit / Export / Delete).
2. **Bulk button** — Select snippets, then click **Duplicate Selected** in the bulk actions bar.

Duplicates are saved as **inactive** copies with the same code, location, conditions, tags, and other metadata.

#### **Condition Logic (OR / AND)**

Open a snippet from **Settings → Perfmatters → Code → Snippets**. A **Condition Logic** panel appears below Perfmatters’ Include / Exclude / Users sections:

| Setting           | **Default (Perfmatters-native)** | **Enhanced option**                       |
| ----------------- | -------------------------------- | ----------------------------------------- |
| Include Rules     | Match **any** row (OR)           | Match **all** rows (AND)                  |
| Exclude Rules     | Exclude when **any** matches     | Exclude only when **all** match           |
| Include vs. users | **Both** sections required       | **Either** section can enable the snippet |
|                   |                                  |                                           |

<AccordionGroup>
  <Accordion title="Geeky Info">
    Logic settings are saved in the snippet’s `conditions` meta as a hidden `sapfp:logic` row (JSON in the exclude list). They survive plugin deactivation like any other snippet field.

    Custom logic is **evaluated while Snippet Admin Pro is active** (runtime shim). With the plugin off, Perfmatters falls back to its built-in rules (include rows are OR; all sections are AND). Reset logic to defaults before deactivating if you rely on non-default behavior.

    All snippet changes are written **directly into Perfmatters’ own snippet files** via `Perfmatters\PMCS\Snippet::update()`. Location, condition logic, and other metadata that live in each snippet’s `.php` docblock — the same storage Perfmatters uses when you save a snippet manually.

    **Persistence (Safe to Deactivate or Uninstall)**

    * All snippet changes are written **directly into Perfmatters’ own snippet files** via `Perfmatters\PMCS\Snippet::update()`. Location, condition logic, and other metadata that lives in each snippet’s `.php` docblock — the same storage Perfmatters uses when you save a snippet manually.
    * This plugin does **not** store snippet data in `wp_options`, custom tables or separate files. If you deactivate or remove Snippet Admin Pro, your snippets and their settings remain exactly as Perfmatters left them.
  </Accordion>
</AccordionGroup>

### Code Snippet Converter

Perfmatters lets you import code snippets you created within Perfmatters, but you're out of luck if you want to bring in snippets from other solutions. **Our Perfmatters Enhancer plugin gets you around that limitation, by converting third-party code snippet exports into the format Perfmatters is looking for.**

Supported export sources include [WPCodeBox](https://influencewp.com/deal/development/wpcodebox/), WPCode, Code Snippets, and other JSON formats with compatible structures.

1. Install and activate the **Perfmatters Enhancer** plugin.
2. Go to **Tools → Snippet Converter.**
3. Upload a **.json** export from another snippet plugin.
4. Review the preview and download the converted file.
5. Import under **Perfmatters → Code → Settings →** Import Code Snippets.

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Do we need Perfmatters?">
    Yes, for the snippet admin tools (they appear in Perfmatters → Code → Snippets). The Snippet Converter still runs without Perfmatters, but you need Perfmatters to import the downloaded file.
  </Accordion>

  <Accordion title="Who is Perfmatters Enhancer for?">
    Agencies and site owners who already use Perfmatters Code Snippets and want faster list management, richer condition matching, or a clean path from other code snippet solutions.
  </Accordion>
</AccordionGroup>
