---
title: "Get Snippet Ability: Read a Single Code Snippet by ID in WordPress"
url: https://nexterwp.com/docs/nexter-get-snippet/
date: 2026-05-29
modified: 2026-05-29
author: "sandip patel"
description: "The nexter/get-snippet ability retrieves a single code snippet by its ID from Nexter Extension, returning the full snippet data including code, type, status, conditions, and metadata."
word_count: 213
---

# Get Snippet Ability: Read a Single Code Snippet by ID in WordPress

## Key Takeaways

- Retrieve a single code snippet using the nexter/get-snippet ability by providing a required id parameter.
- Access complete snippet records including fields like code content, type, and active status with the ability's read-only feature.
- Utilize nexter/list-snippets to find snippet IDs when they are unknown prior to using the get-snippet ability.

The **nexter/get-snippet** ability retrieves a single code snippet from Nexter Extension by its ID. It returns the complete snippet record including the code content, type, active status, display conditions, and all metadata. Use this ability to read snippet details before editing or toggling.

## Key Takeaways

The id parameter is required. The ability returns an error if the snippet is not found.

The id value is a string, not an integer.

This ability is read-only. It never modifies the snippet.

Use nexter/list-snippets to find snippet IDs when you do not know them in advance.

## Required Setup

This ability ships with Nexter Extension (Free). If you do not have it installed, follow the guide on how to install and activate Nexter Extension first.

## Parameters

**id** (string, required) is the unique identifier of the snippet to retrieve.

## What It Returns

The ability returns the full snippet object. Fields include: **id**, **name**, **code**, **type** (php, css, javascript, or htmlmixed), **status** (active or inactive), **description**, **tags**, **location**, **code_execute**, **priority**, **insertion**, **start_date**, **end_date**, **include_rules**, **exclude_rules**, and **php_hidden_execute**.

## When to Use This Ability

Retrieve full snippet details before passing them to nexter/update-snippet.

Display snippet code and metadata in an admin interface or reporting tool.

Verify snippet conditions and rules before toggling its status.

## Related Documentation

List Snippets Ability: nexter/list-snippets

Update Snippet Ability: nexter/update-snippet

Toggle Snippet Ability: nexter/toggle-snippet