# WP-CLI parancsok

> A wp lw-pixel parancsai: status, list, config list/get/set/reset és migrate, valódi kimenetekkel.

Főparancs: `wp lw-pixel`. Alparancsok: `status`, `list`, `config` (`list`, `get`, `set`, `reset`), `migrate` (`list`, `preview`, `run`). A kimenet angol.

## status

Állapot-összesítő. Kapcsolója nincs.

```text title="Kimenet"
$ wp lw-pixel status
setting	value
Version	1.4.1
Configured pixels	0 / 12
Disable for admins	On
Medical mode	Off
LDU mode	Off
Meta CAPI	Off
GA4 Measurement Protocol	Off
```

A „Configured” azt jelenti: bekapcsolva, és van azonosító. A `Disable for admins	On` sor mutatja, hogy adminként bejelentkezve nem fut a pixel ([Tesztelés](https://hub.hellowp.io/hu/docs/lw-plugins/lw-pixel/teszteles/)). A ChatGPT Ads Conversions API állapotát a `status` nem mutatja.

## list

`wp lw-pixel list [--format=<table|json|csv|yaml>] [--configured]`. A `--configured` csak a beállított pixeleket listázza.

```text title="Kimenet"
$ wp lw-pixel list
id	label	enabled	configured
fb	Meta (Facebook) Pixel	no	no
ga4	Google Analytics 4	no	no
gads	Google Ads	no	no
gtm	Google Tag Manager	no	no
tiktok	TikTok Pixel	no	no
pinterest	Pinterest Tag	no	no
bing	Microsoft Bing UET	no	no
reddit	Reddit Pixel	no	no
snapchat	Snapchat Pixel	no	no
x	X (Twitter) Pixel	no	no
chatgpt	ChatGPT Ads	no	no
barion	Barion Pixel	no	no

$ wp lw-pixel list --configured
Warning: No pixels found.
```

## config list

`wp lw-pixel config list [--format=<table|json|csv|yaml>] [--changed]`. Oszlopok: `key`, `value`, `default`, `is_default`. A titkok `********`-ként látszanak. A `--changed` csak az alapértéktől eltérőket listázza.

```text title="Kimenet (részlet)"
$ wp lw-pixel config list
key	value	default	is_default
fb_enabled	false	false	yes
fb_pixel_id			yes
...
ga4_anonymize_ip	true	true	yes
...
event_pageview	true	true	yes
event_scroll_thresholds	25,50,75,100	25,50,75,100	yes
...
consent_analytics_pixels	ga4, bing	ga4, bing	yes
consent_unclassified_pixels	gtm	gtm	yes
compliance_ldu_mode	auto	auto	yes
disable_for_admins	true	true	yes
```

## config get

```text title="Kimenet"
$ wp lw-pixel config get disable_for_admins
true

$ wp lw-pixel config get nope
Error: Unknown setting key: 'nope'
```

## config set

`wp lw-pixel config set <key> <value>`

```bash title="Terminál"
wp lw-pixel config set fb_enabled true
wp lw-pixel config set fb_pixel_id 1234567890
wp lw-pixel config set ga4_measurement_id G-XXXXXXX
wp lw-pixel config set consent_marketing_pixels "fb,tiktok,pinterest"
wp lw-pixel config set head_code '<script>…</script>' --user=admin
```

Siker: `Success: Set '<key>' to '<érték>'.` (titoknál maszkolva).

> **A CLI nem ellenőrzi az értéket**
>
> - Be/ki kulcsnál csak a `true`, `1`, `yes` és `on` jelent bekapcsolást. **Minden más kikapcsol**, egy elírt `tru` is.
> - A formátumot nem ellenőrzi: egy hibás GA4-azonosítót is elment. A felület ellenőriz, ezért beállítás után nézd meg a fület.

Hibák:

- `Unknown setting key: '<key>'`: elgépelt kulcs; a kulcsok listája: `wp lw-pixel config list`.
- `'<key>' needs a user with the unfiltered_html capability. Run it with --user=<administrator>.`: az egyéni kód kulcsai (`head_code`, `body_open_code`, `footer_code`) csak `--user=` megadásával írhatók.
- `Failed to update '<key>'.`: ez akkor is megjelenik, ha az új érték megegyezik a régivel.

## config reset

`wp lw-pixel config reset [--yes]`: minden beállítást alapértékre állít, a titkos kulcsokat is törli. Rákérdez (`Reset all LW Pixel settings to defaults?`), a `--yes` ezt kihagyja. Siker: `All settings reset to defaults.`

## migrate

Import a PixelYourSite (Free / Pro) beállításaiból. Az importer azonosítója `pys`.

```text title="Kimenet (PixelYourSite nélküli oldalon)"
$ wp lw-pixel migrate list
id	label	available
pys	PixelYourSite (Free / Pro)	no

$ wp lw-pixel migrate preview pys
Error: Migrator 'pys' is not available on this site (source plugin / data not found).
```

- `migrate preview pys [--format=…]`: oszlopok `key`, `from`, `to`; titok maszkolva. Ha nincs mit átvinni: `No changes — nothing to migrate.`
- `migrate run pys [--yes]`: rákérdez, majd: `Migration "pys" finished — N updated, M skipped.`, utána az `Updated:` és `Skipped:` lista.
- Ismeretlen azonosítónál: `Unknown migrator: '<id>'. Run 'wp lw-pixel migrate list' to see available ids.`
