PHPackages                             wpify/custom-fields - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wpify/custom-fields

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wpify/custom-fields
===================

WPify Custom Fields

4.6.8(1mo ago)1325.8k↑27.5%31GPL-3.0-or-laterPHPPHP ^8.1CI passing

Since Mar 31Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/wpify/custom-fields)[ Packagist](https://packagist.org/packages/wpify/custom-fields)[ RSS](/packages/wpify-custom-fields/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (270)Used By (1)

WPify Custom Fields
===================

[](#wpify-custom-fields)

[![PHP 8.1+](https://camo.githubusercontent.com/ded3f21b4ee155c4f46e4f63a37b7e31b98cd43e858ce479d956ddee84edbe11/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d374138364238)](https://camo.githubusercontent.com/ded3f21b4ee155c4f46e4f63a37b7e31b98cd43e858ce479d956ddee84edbe11/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d374138364238)[![WordPress 6.2+](https://camo.githubusercontent.com/48b1541eca1d30711fdb2fc9ddc60cb4da47f4729ce4d84e40fb4a7c5f9c18b9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f576f726450726573732d362e322532422d323137353942)](https://camo.githubusercontent.com/48b1541eca1d30711fdb2fc9ddc60cb4da47f4729ce4d84e40fb4a7c5f9c18b9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f576f726450726573732d362e322532422d323137353942)[![License](https://camo.githubusercontent.com/8715433fb2732c619b174c95cb954d7f83d06a2a76a6e84263b11db5f93fd2ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c2d2d332e302d2d6f722d2d6c617465722d626c7565)](https://camo.githubusercontent.com/8715433fb2732c619b174c95cb954d7f83d06a2a76a6e84263b11db5f93fd2ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c2d2d332e302d2d6f722d2d6c617465722d626c7565)[![Packagist Version](https://camo.githubusercontent.com/cb61f8af5e930726518136d398de786ba4e55c59390429fefe8f5761be34c8ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77706966792f637573746f6d2d6669656c6473)](https://camo.githubusercontent.com/cb61f8af5e930726518136d398de786ba4e55c59390429fefe8f5761be34c8ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77706966792f637573746f6d2d6669656c6473)

A developer-oriented WordPress library for custom fields. 59 field types, 15 integration points (metaboxes, options pages, taxonomies, users, Gutenberg blocks, WooCommerce products/orders/coupons, and more), zero PHP dependencies, native WordPress storage — values are plain `get_post_meta()` / `get_option()` calls with no proprietary getters.

Quick Start
-----------

[](#quick-start)

```
// Register a metabox with custom fields.
wpify_custom_fields()->create_metabox(
	array(
		'id'         => 'project_details',
		'title'      => __( 'Project Details', 'my-plugin' ),
		'post_types' => array( 'post' ),
		'items'      => array(
			'project_name' => array(
				'type'     => 'text',
				'label'    => __( 'Project Name', 'my-plugin' ),
				'required' => true,
			),
			'budget' => array(
				'type'  => 'number',
				'label' => __( 'Budget', 'my-plugin' ),
			),
			'is_featured' => array(
				'type'  => 'toggle',
				'label' => __( 'Featured', 'my-plugin' ),
				'title' => __( 'Show on the homepage', 'my-plugin' ),
			),
			'cover_image' => array(
				'type'       => 'attachment',
				'label'      => __( 'Cover Image', 'my-plugin' ),
				'conditions' => array(
					array( 'field' => 'is_featured', 'value' => true ),
				),
			),
		),
	)
);
```

Reading values — standard WordPress functions, no proprietary API required:

```
$name  = get_post_meta( $post_id, 'project_name', true );
$image = get_post_meta( $post_id, 'cover_image', true ); // Attachment ID.
```

Why This Library
----------------

[](#why-this-library)

- **59 field types** in 6 categories — from simple inputs to repeaters, groups, maps, code editors, and more
- **15 integration points** — post metaboxes, options pages, taxonomies, users, comments, menu items, Gutenberg blocks, WooCommerce products/variations/orders/coupons/settings/subscriptions/memberships, multisite
- **Native WordPress storage** — uses `post_meta`, `term_meta`, `options`, block attributes; no custom tables, no lock-in
- **Zero PHP dependencies** — a single Composer package, nothing extra to manage
- **Modern stack** — PHP 8.1+ with strict typing, React 18 UI, container queries, CSS custom properties
- **Conditional logic** — show/hide fields with 12 operators, AND/OR groups, nested conditions, dot-notation paths
- **Fluent FieldFactory API** — IDE-friendly PHP 8 named parameters with full autocomplete
- **Extensible** — register custom field types via PHP filters and JS hooks

Field Types
-----------

[](#field-types)

### Simple (22)

[](#simple-22)

TypeDescription`text`Single-line text input`textarea`Multi-line text input`number`Numeric input with min/max/step`email`Email address input`password`Password input`tel`Phone number input`url`URL input`date`Date picker`datetime`Date and time picker`time`Time picker`month`Month picker`week`Week picker`date_range`Start and end date pair`select`Dropdown select (sync or async options)`multi_select`Multiple selection dropdown`radio`Radio button group`checkbox`Single checkbox`multi_checkbox`Checkbox group`toggle`On/off switch`multi_toggle`Toggle group`color`Color picker`range`Range slider### Relational (10)

[](#relational-10)

TypeDescription`post`Single post selector`multi_post`Multiple post selector`term`Single term selector`multi_term`Multiple term selector`attachment`Media library file picker`multi_attachment`Gallery / multiple files`direct_file`Direct file upload (no media library)`multi_direct_file`Multiple direct file uploads`link`Link with URL, title, and target`multi_link`Multiple links### Complex (6)

[](#complex-6)

TypeDescription`group`Field group (nested fields)`cloudflare`Cloudflare zone connection`code`Code editor with syntax highlighting`wysiwyg`TinyMCE rich text editor`mapycz`Mapy.cz map with coordinates`inner_blocks`Gutenberg InnerBlocks### Repeater (14)

[](#repeater-14)

TypeDescription`multi_group`Repeatable field group`multi_text`Repeatable text`multi_textarea`Repeatable textarea`multi_number`Repeatable number`multi_email`Repeatable email`multi_tel`Repeatable phone`multi_url`Repeatable URL`multi_date`Repeatable date`multi_datetime`Repeatable datetime`multi_time`Repeatable time`multi_month`Repeatable month`multi_week`Repeatable week`multi_date_range`Repeatable date range`multi_mapycz`Repeatable map### Static (5)

[](#static-5)

TypeDescription`html`Custom HTML content`button`Action button`multi_button`Button group`title`Section title / heading`hidden`Hidden input### Visual (2)

[](#visual-2)

TypeDescription`wrapper`Visual wrapper around fields`columns`Multi-column layoutIntegration Points
------------------

[](#integration-points)

### WordPress Core

[](#wordpress-core)

MethodContext`create_metabox()`Post / CPT meta box`create_gutenberg_block()`Gutenberg block`create_options_page()`Admin options page`create_taxonomy_options()`Taxonomy term fields`create_user_options()`User profile fields`create_comment_metabox()`Comment meta fields`create_menu_item_options()`Nav menu item fields### WooCommerce

[](#woocommerce)

MethodContext`create_product_options()`Product data tab`create_product_variation_options()`Product variation fields`create_order_metabox()`Order meta box (HPOS compatible)`create_woocommerce_settings()`WooCommerce settings tab`create_coupon_options()`Coupon fields`create_subscription_metabox()`Subscription meta box`create_membership_plan_options()`Membership plan fields### Multisite

[](#multisite)

MethodContext`create_site_options()`Site options pageAll methods are called on the `wpify_custom_fields()` singleton instance.

Features
--------

[](#features)

### Conditional Logic

[](#conditional-logic)

Show or hide fields based on other field values:

```
'show_subtitle' => array(
	'type'  => 'toggle',
	'label' => __( 'Show Subtitle', 'my-plugin' ),
),
'subtitle' => array(
	'type'       => 'text',
	'label'      => __( 'Subtitle', 'my-plugin' ),
	'conditions' => array(
		array( 'field' => 'show_subtitle', 'value' => true ),
	),
),
```

Supported operators: `==`, `!=`, `>`, `>=`, ` 'my_metabox',
		'title' => __( 'Settings', 'my-plugin' ),
		'tabs'  => array(
			'general' => __( 'General', 'my-plugin' ),
			'advanced' => __( 'Advanced', 'my-plugin' ),
		),
		'items' => array(
			'title' => array(
				'type'  => 'text',
				'label' => __( 'Title', 'my-plugin' ),
				'tab'   => 'general',
			),
			'custom_css' => array(
				'type'     => 'code',
				'label'    => __( 'Custom CSS', 'my-plugin' ),
				'language' => 'css',
				'tab'      => 'advanced',
			),
		),
	)
);
```

### Fluent FieldFactory API

[](#fluent-fieldfactory-api)

Build field definitions with PHP 8 named parameters and full IDE autocomplete:

```
$f = wpify_custom_fields()->field_factory;

wpify_custom_fields()->create_metabox(
	array(
		'id'         => 'team_metabox',
		'title'      => __( 'Team', 'my-plugin' ),
		'post_types' => array( 'page' ),
		'items'      => array(
			'team_members' => $f->multi_group(
				label: __( 'Team Members', 'my-plugin' ),
				min: 1,
				max: 20,
				items: array(
					'name'  => $f->text( label: __( 'Name', 'my-plugin' ), required: true ),
					'role'  => $f->text( label: __( 'Role', 'my-plugin' ) ),
					'photo' => $f->attachment( label: __( 'Photo', 'my-plugin' ), attachment_type: 'image' ),
				),
			),
		),
	)
);
```

### Extensibility

[](#extensibility)

- **PHP filters**: `wpifycf_sanitize_{type}`, `wpifycf_wp_type_{type}`, `wpifycf_default_value_{type}`, `wpifycf_items`
- **JS hooks** (`@wordpress/hooks`): `wpifycf_field_{type}`, `wpifycf_definition`, `wpifycf_generator_{name}`

See the [Extending documentation](docs/features/extending.md) for a full guide on creating custom field types.

Installation
------------

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer require wpify/custom-fields
```

Include the Composer autoloader in your plugin or theme:

```
require_once __DIR__ . '/vendor/autoload.php';
```

### As a WordPress Plugin

[](#as-a-wordpress-plugin)

Download from the [Releases page](https://github.com/wpify/custom-fields/releases), upload to `/wp-content/plugins/`, and activate.

Requirements
------------

[](#requirements)

- PHP 8.1+
- WordPress 6.2+
- `ext-json`
- Modern browser (Chrome, Firefox, Safari, Edge)
- WooCommerce 8.0+ (optional, for WooCommerce integrations)

Documentation
-------------

[](#documentation)

- [Getting Started](docs/index.md)
- [Field Types](docs/field-types.md)
- [Integrations](docs/integrations.md)
- [Conditional Logic](docs/features/conditions.md)
- [Tabs](docs/features/tabs.md)
- [Validation](docs/features/validation.md)
- [Field Factory](docs/features/field-factory.md)
- [Generators](docs/features/generators.md)
- [Extending](docs/features/extending.md)
- [REST API](docs/features/rest-api.md)
- [Type Aliases](docs/features/type-aliases.md)
- [Migration from 3.x to 4.x](docs/migration-3-to-4.md)

License
-------

[](#license)

WPify Custom Fields is released under the [GPL-3.0-or-later](https://www.gnu.org/licenses/gpl-3.0.html) license.

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance87

Actively maintained with recent releases

Popularity36

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 86.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

266

Last Release

52d ago

Major Versions

1.5.7 → 2.0.02021-09-08

2.3.5 → 3.0.02022-02-18

3.14.2 → 4.0.02024-11-13

PHP version history (4 changes)1.0.0PHP &gt;=7.3.0||^8.0.0

3.4.0PHP &gt;=7.4||&lt;=8.1

3.12.7PHP &gt;=7.4.33

4.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b322ef9c319c869892c6dcf05296386fa00fc53516df65e438d1cbb72ec3b7ee?d=identicon)[mejta](/maintainers/mejta)

![](https://www.gravatar.com/avatar/92d6ba0cde4324b12697fe98421d2430b68bff0a981225d42b103fb53dea16f5?d=identicon)[vasikgreif](/maintainers/vasikgreif)

---

Top Contributors

[![mejta](https://avatars.githubusercontent.com/u/498441?v=4)](https://github.com/mejta "mejta (551 commits)")[![vaclavgreif](https://avatars.githubusercontent.com/u/1177553?v=4)](https://github.com/vaclavgreif "vaclavgreif (52 commits)")[![vyskoczilova](https://avatars.githubusercontent.com/u/3611726?v=4)](https://github.com/vyskoczilova "vyskoczilova (15 commits)")[![martin-z-wpify](https://avatars.githubusercontent.com/u/239775915?v=4)](https://github.com/martin-z-wpify "martin-z-wpify (8 commits)")[![hexcross](https://avatars.githubusercontent.com/u/1681339?v=4)](https://github.com/hexcross "hexcross (7 commits)")[![dusanzvonar](https://avatars.githubusercontent.com/u/18530315?v=4)](https://github.com/dusanzvonar "dusanzvonar (2 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/wpify-custom-fields/health.svg)

```
[![Health](https://phpackages.com/badges/wpify-custom-fields/health.svg)](https://phpackages.com/packages/wpify-custom-fields)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
