Composer
composer require rwsite/wp-field
Вручную
HTML Fields Library for WordPress
Final v4 release for building custom frameworks, settings systems, and admin UI.
Fluent API, 52 field types, legacy compatibility, and React/Vanilla integrations where needed.
Features • Installation • Quick Start • Architecture • Field Types • Demo Pages • Development • RU version
WP_Field v4 is the production-ready release of the modern field API. Use it for new integrations and for migrations away from ad-hoc legacy arrays. The modern layer gives you a typed, fluent field builder and a cleaner server-rendered integration model for WordPress forms.
This is not a WordPress-free browser runtime. Interactive fields still rely on core WordPress admin assets where that is the correct production integration.
vanilla/ and remains available for compatibility.WpFieldFieldFieldWP_Field has two layers:
WpFieldFieldField and classes under src/Field/Types/WP_Field.php and vanilla/Use the modern API for new code. Keep the legacy layer for existing integrations, unsupported custom field types, or the standalone vanilla package.
Field::make() or a typed shortcut.The modern layer still uses WordPress-provided functionality for these features:
wp.media / Media Modal — media, image, file, gallery, backgroundwp-color-picker — color, palette, and color-based composite controlswp.editor — classic editor fieldswp.codeEditor — code editor fieldsjquery-ui-sortable — sortable, sorter, repeater, flexible_contentjquery-ui-datepicker — date and time UI where WordPress-native pickers are expecteddashicons or another icon library — iconDo not unload these assets on screens that render interactive fields unless you replace them with an equivalent setup.
composer require rwsite/wp-field
wp-content/plugins/wp-field-plugincomposer install --no-devnpm install
npm run build
You can export the legacy runtime as a separate WordPress plugin that does not depend on the original woo2iiko plugin directory.
npm run build:standalone
The build script:
vanilla/dist/wp-field-vanilla/dist/wp-field-vanilla.zipThe standalone package includes only the runtime required for the vanilla version:
wp-field-vanilla.phpREADME.txtvanilla/bootstrap.phpvanilla/WP_Field.phpvanilla/assets/css/wp-field.cssvanilla/assets/js/wp-field.jslang/wp-field.potlang/wp-field-ru_RU.polang/wp-field-ru_RU.molang/wp-field-ru_RU.l10n.phpIt does not include the modern React layer, demo pages, tests, source SCSS, or repository-only development files.
use WpFieldContainerMetaboxContainer;
use WpFieldFieldField;
$field = Field::text('email')
->label('Email Address')
->placeholder('user@example.com')
->required();
echo $field->render();
$metabox = new MetaboxContainer('product_details', [
'title' => 'Product Details',
'post_types' => ['product'],
]);
$metabox->addField(
Field::text('sku')->label('SKU')->required()
);
$metabox->addField(
Field::text('price')->label('Price')->required()
);
$metabox->register();
Field::repeater('team_members')
->label('Team Members')
->fields([
Field::text('name')->label('Name')->required(),
Field::text('position')->label('Position'),
Field::make('email', 'email')->label('Email'),
])
->min(1)
->max(10)
->buttonLabel('Add Member')
->layout('table');
Field::flexibleContent('page_sections')
->label('Page Sections')
->addLayout('text_block', 'Text Block', [
Field::text('heading')->label('Heading'),
Field::make('textarea', 'content')->label('Content'),
])
->addLayout('image_block', 'Image Block', [
Field::make('image', 'image')->label('Image'),
Field::text('caption')->label('Caption'),
])
->min(1)
->buttonLabel('Add Section');
Field::make('map', 'location')
->label('Location')
->provider('google')
->apiKey('your-api-key')
->zoom(12)
->center(['lat' => 55.7558, 'lng' => 37.6173]);
Containers integrate fields with WordPress screens and persistence:
MetaboxContainer — post meta and metaboxesSettingsContainer — settings pages and optionsTaxonomyContainer — taxonomy forms and term metaUserContainer — user profile forms and user metaStorage strategies:
PostMetaStorageTermMetaStorageUserMetaStorageOptionStorageCustomTableStoragetextpasswordemailurltelnumberrangehiddentextareaselectmultiselectradiocheckboxcheckbox_groupeditormediaimagefilegallerycolordatetimedatetime-localgrouprepeaterswitcherspinnerbutton_setsliderheadingsubheadingnoticecontentfieldsetaccordiontabbedtypographyspacingdimensionsborderbackgroundlink_colorcolor_groupimage_selectcode_editoriconmapsortablesorterpalettelinkbackupdate_time → datetime-localdatetime → datetime-localimagepicker → image_pickerIn WordPress admin debug mode, the plugin registers demo pages under Tools:
Routes:
/wp-admin/tools.php?page=wp-field-examples/wp-admin/tools.php?page=wp-field-components/wp-admin/tools.php?page=wp-field-ui-demonpm run dev
npm run lint
npm run build
npm run dev starts Vite and watches vanilla/assets/scss/wp-field-examples-vanilla.scss to rebuild vanilla/assets/css/wp-field-examples-vanilla.css.
Edit SCSS sources under vanilla/assets/scss/. Do not edit generated CSS manually.
composer test
composer analyse
composer lint:check
./.agents/skills/qa-gate/scripts/verify.sh
See CHANGELOG.md for version history.
GPL v2 or later
Aleksei Tikhomirov (https://rwsite.ru)