Nik Custom Fields — Live Demo

Every field type the plugin registers, and every documented call, executed live on this page. Left: what the editor works with and the call a template makes. Right: what that call returned.

36 field types registered, 36 present on this page. Every registered type is on this page.

A The field types

One block per type: what the editor sees, the call, the result.

textText

In the editor

Single-line input. Placeholder, character limit, default value, prefix/suffix.

In the template

nik_the_field( 'd_text' );

Output

A complete custom fields toolkit

textareaTextarea

In the editor

Multi-line plain text. Row count is a setting.

In the template

nik_the_field( 'd_textarea' );

Output

Plain text, kept verbatim.
Ampersands & quotes "survive" — no double escaping.

numberNumber

In the editor

Numeric input with min, max, step and a prefix. Decimals are kept.

In the template

nik_get_field( 'd_number' );   // float
nik_the_field( 'd_number' );   // localised

Output

19.99
19.99

rangeRange slider

In the editor

Slider with a live value readout.

In the template

nik_get_field( 'd_range' );

Output

65

emailEmail

In the editor

Email input. An address that does not validate is rejected on save.

In the template

nik_the_field( 'd_email' );

urlURL

In the editor

URL input.

In the template

nik_the_field( 'd_url' );

passwordPassword

In the editor

Masked input. Stored verbatim, printed as dots.

In the template

nik_the_field( 'd_password' );

Output

••••••••

wysiwygRich text (editor)

The gallery below is a [gallery] shortcode typed into the editor.

In the editor

The real WordPress editor: TinyMCE, Quicktags, media button. Shortcodes run on output.

In the template

nik_the_field( 'd_wysiwyg' );

Output

Rich text from the real WordPress editor — lists, links and shortcodes all work:

  • TinyMCE and Quicktags
  • Media button

selectSelect

In the editor

Dropdown. A value outside the configured list is refused.

In the template

nik_get_field( 'd_select' );

Output

live

radioRadio

In the editor

Radio buttons.

In the template

nik_get_field( 'd_radio' );

Output

high

button_groupButton group

In the editor

One choice, shown as a row of buttons.

In the template

nik_get_field( 'd_buttons' );

Output

m

checkboxCheckbox

In the editor

A single tick box.

In the template

nik_get_field( 'd_checkbox' );   // bool

Output

true

true_falseTrue / False

In the editor

On-off switch with its own label.

In the template

nik_get_field( 'd_truefalse' );  // bool

Output

true

imageImage

In the editor

Media library picker. Return format: id, URL, or the full array.

In the template

$img = nik_get_field( 'd_image' );
echo $img['sizes']['medium'];

Output

{
    "id": 933,
    "alt": "",
    "width": 800,
    "height": 800
}

galleryGallery

In the editor

Several images, reorderable by dragging.

In the template

foreach ( nik_get_field( 'd_gallery' ) as $img ) {
    echo $img['sizes']['thumbnail'];
}

Output

4 images

fileFile

In the editor

Any attachment, not just images. Allowed extensions are a setting.

In the template

nik_the_field( 'd_file' );

icon_pickerIcon picker

In the editor

A dashicon or an image URL.

In the template

nik_the_field( 'd_icon' );

Output

dashicons-star-filled

oembedoEmbed

In the editor

A URL from any oEmbed provider; the embed is resolved on output.

In the template

nik_the_field( 'd_oembed' );

Output

linkLink

In the editor

URL, link text and an open-in-new-tab switch.

In the template

nik_the_field( 'd_link' );        // <a> with rel=noopener
nik_get_field( 'd_link' );        // array

Output

Product page
{
    "url": "https://products.nikdimon.com/products/nik-custom-fields/",
    "title": "Product page",
    "target": "_blank"
}

color_pickerColour

In the editor

Native swatch plus a hex box.

In the template

nik_the_field( 'd_color' );

Output

#2271b1

google_mapGoogle Map

In the editor

Latitude, longitude and an address.

In the template

nik_the_field( 'd_map' );
nik_get_field( 'd_map' );

Output

Kyiv, Ukraine
{
    "address": "Kyiv, Ukraine",
    "lat": 50.4501,
    "lng": 30.5234,
    "zoom": 14
}

date_pickerDate

In the editor

Date only. Stored sortable, printed in the site format.

In the template

nik_get_field( 'd_date', false, false );  // raw
nik_the_field( 'd_date' );                // formatted

Output

2026-08-06
06.08.2026

date_time_pickerDate and time

In the editor

Date with a time of day.

In the template

nik_the_field( 'd_datetime' );

Output

06.08.2026 17:30

time_pickerTime

In the editor

Time of day.

In the template

nik_get_field( 'd_time' );

Output

09:15:00

post_objectPost object

In the editor

Search picker for one entry. Nothing is loaded until you type.

In the template

$post = nik_get_field( 'd_postobject' );
echo $post->post_title;

Output

WP_Post #701 Images auto convert — 1

page_linkPage link

In the editor

Same picker, but the value is the permalink.

In the template

nik_the_field( 'd_pagelink' );

Output

(empty)

relationshipRelationship (posts)

In the editor

Search picker for several entries, reorderable.

In the template

foreach ( nik_get_field( 'd_relationship' ) as $post ) {
    echo get_permalink( $post );
}

taxonomyRelationship (terms)

In the editor

Search picker over terms of any taxonomy.

In the template

nik_get_field( 'd_taxonomy' );

Output

{
    "term_id": 1,
    "name": "Без рубрики",
    "slug": "%d0%b1%d0%b5%d0%b7-%d1%80%d1%83%d0%b1%d1%80%d0%b8%d0%ba%d0%b8",
    "term_group": 0,
    "term_taxonomy_id": 1,
    "taxonomy": "category",
    "description": "",
    "parent": 0,
    "count": 0,
    "filter": "raw"
}

userRelationship (users)

In the editor

Search picker over site users.

In the template

nik_get_field( 'd_user' );

Output

{
    "id": 1,
    "login": "PaperAdmin1873",
    "display_name": "PaperAdmin1873",
    "email": "dmitrij.nikolaenko.91@gmail.com",
    "roles": [
        "administrator"
    ]
}

groupGroup

In the editor

Several fields kept together under one name.

In the template

$d = nik_get_field( 'd_group' );
echo $d['w'] . '×' . $d['h'] . ' ' . $d['u'];

Output

{
    "w": 120,
    "h": 80,
    "u": "cm"
}

repeaterRepeater

In the editor

Rows of subfields, added and reordered by the editor.

In the template

while ( nik_have_rows( 'd_specs' ) ) : nik_the_row();
    echo nik_get_row_index();
    echo nik_get_sub_field( 'name' );
    echo nik_get_sub_field( 'value' );
endwhile;

Output

#namevalueicon
1Weight1.2
2Length48
3Volume0.75

repeaterRepeater

The same type again, nested — this is the case most alternatives get wrong.

In the editor

A repeater inside a repeater. Nesting has no fixed limit.

In the template

while ( nik_have_rows( 'd_sections' ) ) : nik_the_row();
    echo nik_get_sub_field( 'title' );

    while ( nik_have_rows( 'items' ) ) : nik_the_row();
        echo nik_get_sub_field( 'label' );
    endwhile;
endwhile;

Output

Before release

  • ✅ Run the test suites
  • ✅ Update the changelog
  • ⬜ Tag the release

After release

  • ⬜ Publish the product page

flexibleFlexible content

In the editor

The editor picks from named layouts, in any order, as many times as needed.

In the template

while ( nik_have_rows( 'd_flex' ) ) : nik_the_row();
    if ( 'hero' === nik_get_row_layout() ) { … }
endwhile;

Output

hero Flexible content, three layouts
quote Each row resolves against its own layout. — The documentation
columns
First cell
Second cell
Third cell

cloneClone (reuse a group)

In the editor

The fields of another group, reused without copying their configuration.

In the template

$a = nik_get_field( 'd_clone' );
echo $a['street'] . ', ' . $a['city'];

Output

Khreshchatyk 1, Kyiv 01001

{
    "street": "Khreshchatyk 1",
    "city": "Kyiv",
    "zip": "01001"
}

tabTab / separator

In the editor

Splits a long group into tabs in the editor. Holds no value.

In the template

// nothing to read

Output

By design: layout only

accordionAccordion

In the editor

Collapsible section in the editor. Holds no value.

In the template

// nothing to read

Output

By design: layout only

messageMessage (no value)

In the editor

A note shown to the editor. Holds no value.

In the template

// nothing to read

Output

By design: layout only

B Conditional logic

Rules run in the editor. A hidden field keeps its value.

nik_get_field( 'd_conditional' )   // shown only while Select = live
Visible because Select is "live"

C Bidirectional relationship

Linking one side wrote the other. Nothing was entered on the linked page.

nik_get_field( 'd_linked' )                    // here
[1835]

D Field objects and bulk reads

nik_get_field_object( 'd_select' )
{
    "key": "d_select",
    "uid": "nikf_69f0cbb6950774f9644d",
    "label": "Select",
    "name": "d_select",
    "type": "select",
    "instructions": "",
    "required": false,
    "width": 100,
    "choices": [
        "draft",
        "review",
        "live"
    ],
    "settings": null,
    "value": "live"
}
nik_get_sub_field_object( 'value' )   // inside a row
{
    "key": "value",
    "label": "Value",
    "type": "number",
    "width": 50,
    "required": 0
}
nik_get_fields()
47 fields: tab_basics, d_message, d_accordion, d_text, d_textarea, d_number, d_range, d_email, d_url, d_password, d_wysiwyg, tab_choices …

E Other targets

The same API, addressed with option / user_N / term_N.

nik_get_field( 'o_company', 'option' )
NikDimon Products
nik_get_field( 'o_logo', 'option' )
while ( nik_have_rows( 'o_socials', 'option' ) ) …
nik_get_field( 'u_job', 'user_1' )
Plugin author
nik_get_field( 'c_tagline', 'term_49' )
NULL

F Field group declared in code

Registered from a PHP file, so the configuration can live in git.

nik_add_local_field_group( array(
    'key'    => 'ncf-local',
    'fields' => array( array( 'key' => 'l_badge', 'type' => 'text' ) ),
) );
nik_get_field( 'l_badge' )
Declared in PHP

G Gutenberg block

A block whose attributes are a field group; its template reads them with the same API.

H Shortcodes

For editors who work in the content area rather than in templates.

[nik_cf_field field="d_text"]
A complete custom fields toolkit
[nik_cf_field field="nope" default="fallback"]
fallback
[nik_cf_gallery field="d_gallery" size="thumbnail"]
[nik_cf_group group="ncf-address"]

I Querying by field value

Values are stored under a stable id, so nik_meta_key() turns the name you know into the key WP_Query needs.

nik_meta_key( 'd_specs', '0_name' )
_nik_cf_uid_nikf_659b3011241c91f7612f_0_name
'meta_query' => array( array(
    'key'   => nik_meta_key( 'd_specs', '0_name' ),
    'value' => 'Weight',
) )
Nik Custom Fields — Live Demo
nik_meta_key( 'd_sections', '0_items_1_label' )   // any depth
Nik Custom Fields — Live Demo
'meta_key' => nik_meta_key( 'd_number' ),
'orderby'  => 'meta_value_num'
Nik Custom Fields — Live Demo

J REST API

Opt-in per field group. This group has it enabled.

endpointwhat it does
GET /wp-json/wp/v2/pages/939core response gains a nik_fields object
GET /wp-json/nik-cf/v1/fields/page/939values in their return format
POST /wp-json/nik-cf/v1/fields/page/939write values
GET /wp-json/nik-cf/v1/field-groupsthe configuration itself
GET /wp-json/nik-cf/v1/options/ncf-demo-optionsan options page

K Front-end form

The same renderers and validation as a meta box. Only shown to someone who may edit this page.

Hidden: a front-end form needs a logged-in user with edit_post on this page. That check runs when rendering and again when accepting the submission.