Replaced our old custom-fields plugin on three sites without touching a template.
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.
A The field types
One block per type: what the editor sees, the call, the result.
textТекст
In the editor
Single-line input. Placeholder, character limit, default value, prefix/suffix.
In the template
nik_the_field( 'd_text' );Output
textareaТекстова Область
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.
numberЧисло
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' ); // localisedOutput
19,99
rangeПовзунок
In the editor
Slider with a live value readout.
In the template
nik_get_field( 'd_range' );Output
emailEmail
In the editor
Email input. An address that does not validate is rejected on save.
In the template
nik_the_field( 'd_email' );Output
urlURL
In the editor
URL input.
In the template
nik_the_field( 'd_url' );passwordПароль
In the editor
Masked input. Stored verbatim, printed as dots.
In the template
nik_the_field( 'd_password' );Output
wysiwygФорматований текст (редактор)
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
selectВибір
In the editor
Dropdown. A value outside the configured list is refused.
In the template
nik_get_field( 'd_select' );Output
radioРадіокнопка
In the editor
Radio buttons.
In the template
nik_get_field( 'd_radio' );Output
button_groupГрупа кнопок
In the editor
One choice, shown as a row of buttons.
In the template
nik_get_field( 'd_buttons' );Output
checkboxПрапорець
In the editor
A single tick box.
In the template
nik_get_field( 'd_checkbox' ); // boolOutput
truetrue_falseТак / Ні
In the editor
On-off switch with its own label.
In the template
nik_get_field( 'd_truefalse' ); // boolOutput
trueimageЗображення
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": 909,
"alt": "",
"width": 800,
"height": 800
}galleryГалерея
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
fileФайл
In the editor
Any attachment, not just images. Allowed extensions are a setting.
In the template
nik_the_field( 'd_file' );Output
{
"id": 899
}icon_pickerВибір значка
In the editor
A dashicon or an image URL.
In the template
nik_the_field( 'd_icon' );Output
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
linkПосилання
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' ); // arrayOutput
{
"url": "https://products.nikdimon.com/products/nik-custom-fields/",
"title": "Product page",
"target": "_blank"
}color_pickerКолір
In the editor
Native swatch plus a hex box.
In the template
nik_the_field( 'd_color' );Output
google_mapКарта Google
In the editor
Latitude, longitude and an address.
In the template
nik_the_field( 'd_map' );
nik_get_field( 'd_map' );Output
{
"address": "Kyiv, Ukraine",
"lat": 50.4501,
"lng": 30.5234,
"zoom": 14
}date_pickerДата
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' ); // formattedOutput
06.08.2026
date_time_pickerДата й час
In the editor
Date with a time of day.
In the template
nik_the_field( 'd_datetime' );Output
time_pickerЧас
In the editor
Time of day.
In the template
nik_get_field( 'd_time' );Output
post_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 Худі Thermal Winterpage_linkПосилання на сторінку
In the editor
Same picker, but the value is the permalink.
In the template
nik_the_field( 'd_pagelink' );Output
relationshipЗв’язок (записи)
In the editor
Search picker for several entries, reorderable.
In the template
foreach ( nik_get_field( 'd_relationship' ) as $post ) {
echo get_permalink( $post );
}taxonomyЗв’язок (терміни)
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": 5,
"filter": "raw"
}userЗв’язок (користувачі)
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"
]
}groupГрупа
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"
}repeaterПовторювач
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
| # | name | value | icon |
|---|---|---|---|
| 1 | Weight | 1.2 | ![]() |
| 2 | Length | 48 | ![]() |
| 3 | Volume | 0.75 | — |
repeaterПовторювач
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
flexibleГнучкий контент
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

cloneКлон (перевикористати групу)
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"
}tabВкладка / роздільник
In the editor
Splits a long group into tabs in the editor. Holds no value.
In the template
// nothing to readOutput
accordionАкордеон
In the editor
Collapsible section in the editor. Holds no value.
In the template
// nothing to readOutput
messageПовідомлення (без значення)
In the editor
A note shown to the editor. Holds no value.
In the template
// nothing to readOutput
B Conditional logic
Rules run in the editor. A hidden field keeps its value.
nik_get_field( 'd_conditional' ) // shown only while Select = liveC Bidirectional relationship
Linking one side wrote the other. Nothing was entered on the linked page.
nik_get_field( 'd_linked' ) // hereD 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()E Other targets
The same API, addressed with option / user_N / term_N.
nik_get_field( 'o_company', 'option' )nik_get_field( 'o_logo', 'option' )
nik_get_field( 'u_job', 'user_1' )nik_get_field( 'c_tagline', 'term_1' )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' )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"][nik_cf_field field="nope" default="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' )'meta_query' => array( array(
'key' => nik_meta_key( 'd_specs', '0_name' ),
'value' => 'Weight',
) )nik_meta_key( 'd_sections', '0_items_1_label' ) // any depth'meta_key' => nik_meta_key( 'd_number' ),
'orderby' => 'meta_value_num'J REST API
Opt-in per field group. This group has it enabled.
| endpoint | what it does |
|---|---|
GET /wp-json/wp/v2/pages/1834 | core response gains a nik_fields object |
GET /wp-json/nik-cf/v1/fields/page/1834 | values in their return format |
POST /wp-json/nik-cf/v1/fields/page/1834 | write values |
GET /wp-json/nik-cf/v1/field-groups | the configuration itself |
GET /wp-json/nik-cf/v1/options/ncf-demo-options | an 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.

