wpify / custom-fields
WPify Custom Fields
Installs: 25 109
Dependents: 2
Suggesters: 0
Security: 0
Stars: 12
Watchers: 3
Forks: 3
Open Issues: 0
pkg:composer/wpify/custom-fields
Requires
- php: ^8.1
- ext-json: *
Requires (Dev)
- dev-master
- 4.6.0
- 4.5.1
- 4.5.0
- 4.4.2
- 4.4.1
- 4.4.0
- 4.3.1
- 4.3.0
- 4.2.1
- 4.2.0
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.74
- 4.0.73
- 4.0.72
- 4.0.71
- 4.0.70
- 4.0.69
- 4.0.68
- 4.0.67
- 4.0.66
- 4.0.65
- 4.0.64
- 4.0.63
- 4.0.62
- 4.0.61
- 4.0.60
- 4.0.59
- 4.0.58
- 4.0.57
- 4.0.56
- 4.0.55
- 4.0.54
- 4.0.53
- 4.0.52
- 4.0.51
- 4.0.50
- 4.0.49
- 4.0.48
- 4.0.47
- 4.0.46
- 4.0.45
- 4.0.44
- 4.0.43
- 4.0.42
- 4.0.41
- 4.0.40
- 4.0.39
- 4.0.38
- 4.0.37
- 4.0.36
- 4.0.35
- 4.0.34
- 4.0.33
- 4.0.32
- 4.0.31
- 4.0.30
- 4.0.29
- 4.0.28
- 4.0.27
- 4.0.26
- 4.0.25
- 4.0.24
- 4.0.23
- 4.0.22
- 4.0.21
- 4.0.20
- 4.0.19
- 4.0.18
- 4.0.17
- 4.0.16
- 4.0.15
- 4.0.14
- 4.0.13
- 4.0.12
- 4.0.11
- 4.0.10
- 4.0.9
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.14.2
- 3.14.1
- 3.14.0
- 3.13.0
- 3.12.14
- 3.12.13
- 3.12.12
- 3.12.11
- 3.12.10
- 3.12.9
- 3.12.8
- 3.12.7
- 3.12.5
- 3.12.4
- 3.12.3
- 3.12.2
- 3.12.1
- 3.12.0
- 3.11.22
- 3.11.21
- 3.11.20
- 3.11.19
- 3.11.18
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- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- dev-render-refactoring
- dev-sections
- dev-undefined-function-fix
This package is auto-updated.
Last update: 2026-02-20 22:46:36 UTC
README
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
// 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
- 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
Simple (22)
| Type | Description |
|---|---|
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)
| Type | Description |
|---|---|
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)
| Type | Description |
|---|---|
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)
| Type | Description |
|---|---|
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)
| Type | Description |
|---|---|
html |
Custom HTML content |
button |
Action button |
multi_button |
Button group |
title |
Section title / heading |
hidden |
Hidden input |
Visual (2)
| Type | Description |
|---|---|
wrapper |
Visual wrapper around fields |
columns |
Multi-column layout |
Integration Points
WordPress Core
| Method | Context |
|---|---|
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
| Method | Context |
|---|---|
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
| Method | Context |
|---|---|
create_site_options() |
Site options page |
All methods are called on the wpify_custom_fields() singleton instance.
Features
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: ==, !=, >, >=, <, <=, between, contains, not_contains, in, not_in, empty, not_empty. Conditions support AND/OR logic, nested groups, and dot-notation paths for nested fields.
Tabs
Organize fields into a tabbed interface:
wpify_custom_fields()->create_metabox( array( 'id' => '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
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
- 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 for a full guide on creating custom field types.
Installation
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
Download from the Releases page, upload to /wp-content/plugins/, and activate.
Requirements
- PHP 8.1+
- WordPress 6.2+
ext-json- Modern browser (Chrome, Firefox, Safari, Edge)
- WooCommerce 8.0+ (optional, for WooCommerce integrations)
Documentation
- Getting Started
- Field Types
- Integrations
- Conditional Logic
- Tabs
- Validation
- Field Factory
- Generators
- Extending
- REST API
- Type Aliases
- Migration from 3.x to 4.x
License
WPify Custom Fields is released under the GPL-3.0-or-later license.