承接 emneslab/custom-meta-box-builder 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

emneslab/custom-meta-box-builder

Composer 安装命令:

composer require emneslab/custom-meta-box-builder

包简介

A modern WordPress meta box builder with 30+ field types, visual admin UI, nested groups, conditional logic, REST API, Gutenberg sidebar, and WP-CLI support.

README 文档

README

Latest Version on Packagist PHP Version License

A modern, developer-friendly WordPress meta box builder with 30+ field types, a visual admin UI, nested/repeatable groups, conditional logic, REST API, Gutenberg sidebar, WP-CLI, and more.

Installation

composer require emneslab/custom-meta-box-builder

Note: This package uses composer/installers with type wordpress-plugin. In a standard WordPress setup it installs to wp-content/plugins/. In Bedrock it installs to web/app/plugins/.

Activate the plugin:

wp plugin activate custom-meta-box-builder

Requirements

  • PHP 8.1+
  • WordPress 6.0+

Quick Start

Register a meta box via PHP

add_custom_meta_box('cmb-book-details', 'Book Details', ['post', 'page'], [
    ['id' => 'book_title',   'type' => 'text',     'label' => 'Book Title', 'required' => true],
    ['id' => 'book_summary', 'type' => 'textarea', 'label' => 'Summary'],
    ['id' => 'book_genre',   'type' => 'select',   'label' => 'Genre', 'options' => [
        'fiction'     => 'Fiction',
        'non_fiction' => 'Non-Fiction',
        'sci_fi'     => 'Science Fiction',
    ]],
    ['id' => 'book_price', 'type' => 'number', 'label' => 'Price'],
], 'normal', 'high');

Retrieve saved data

// Using the public API
$title = cmb_get_field('book_title');
cmb_the_field('book_title'); // echoes escaped value

// Or standard WordPress
$title = get_post_meta(get_the_ID(), 'book_title', true);

Visual Admin Builder

Navigate to CMB Builder in the WordPress admin to create field groups without code. The builder includes:

  • Drag-and-drop field ordering
  • Live PHP code generation
  • Template code snippets (Result tab)
  • Import/Export (JSON)

Features

  • 30+ field types — text, textarea, number, select, checkbox, radio, file, image, gallery, color, date, time, range, toggle, password, post, user, taxonomy, group, flexible content, message, divider, and more
  • Repeatable fields — any field can be made repeatable
  • Nested groups — unlimited depth group-in-group nesting
  • Drag-and-drop — sortable repeater rows
  • Tabs — organize fields into tabbed sections
  • Conditional logic — show/hide fields based on other field values (AND/OR)
  • Validation — required, email, url, min, max, numeric, pattern rules
  • Flexible layouts — horizontal, inline, responsive width classes (25%–100%)
  • Taxonomy meta — add fields to category/tag edit screens
  • User profile meta — add fields to user profile pages
  • Options pages — create admin settings pages
  • REST API — expose fields via show_in_rest
  • Gutenberg sidebar — display fields in block editor sidebar
  • WP-CLIwp cmb list, wp cmb get, wp cmb set
  • Frontend formscmb_render_form() / cmb_the_form()
  • Gutenberg blockscmb_register_block() API
  • WPGraphQL — auto-register fields in GraphQL schema
  • Import/Export — JSON configurations
  • Multi-language — per-locale field values
  • Bulk operations — batch meta updates
  • Extensible — create custom field types by extending AbstractField

Field Types

Category Types
Basic Text, Textarea, Number, Email, URL, Password, Hidden
Content WYSIWYG
Choice Select, Radio, Checkbox, Checkbox List, Toggle, Button Group
Date & Color Date, Time, Color
Media File, Image, Gallery
Relational Post, Taxonomy, User
Layout Group, Flexible Content, Message, Divider
Special Link, oEmbed, Range

Extending

Create a custom field type:

namespace MyPlugin\Fields;

use CMB\Core\Contracts\Abstracts\AbstractField;

class RatingField extends AbstractField {
    public function render(): void {
        $value = $this->getValue();
        printf(
            '<input type="range" name="%s" value="%s" min="1" max="5" step="1">',
            esc_attr($this->getNameAttribute()),
            esc_attr($value)
        );
    }

    public function sanitize(mixed $value): mixed {
        return max(1, min(5, (int) $value));
    }
}

Register it:

use CMB\Core\FieldFactory;

FieldFactory::registerType('rating', \MyPlugin\Fields\RatingField::class);

Hooks

All hooks fire with the cmbbuilder_ prefix (legacy cmb_ prefix is deprecated):

Hook Type Description
cmbbuilder_before_render_field Action Before a field renders
cmbbuilder_after_render_field Action After a field renders
cmbbuilder_before_save_field Action Before a field value is saved
cmbbuilder_after_save_field Action After a field value is saved
cmbbuilder_sanitize_{type} Filter Custom sanitization per field type
cmbbuilder_field_config Filter Modify field config before rendering
cmbbuilder_meta_box_config Filter Modify meta box config at registration
cmbbuilder_admin_box_saved Action After an admin UI field group is saved

Documentation

See the docs/ directory:

Testing

composer install
composer test

License

GPL-2.0-or-later. See LICENSE.

emneslab/custom-meta-box-builder 适用场景与选型建议

emneslab/custom-meta-box-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「wordpress」 「meta-box」 「custom-fields」 「admin-ui」 「gutenberg」 「post-meta」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 emneslab/custom-meta-box-builder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 emneslab/custom-meta-box-builder 我们能提供哪些服务?
定制开发 / 二次开发

基于 emneslab/custom-meta-box-builder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 46
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-04-15