PHPackages                             mbv-media/magic-meta-box - 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. mbv-media/magic-meta-box

AbandonedLibrary

mbv-media/magic-meta-box
========================

Helper class to generate WordPress MetaBoxes.

v1.5(10y ago)013MITPHPPHP &gt;=5.3.0

Since Aug 21Pushed 9y ago1 watchersCompare

[ Source](https://github.com/MBV-Media/MagicMetaBox)[ Packagist](https://packagist.org/packages/mbv-media/magic-meta-box)[ Docs](https://github.com/R4c00n/MagicMetaBox)[ RSS](/packages/mbv-media-magic-meta-box/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

MagicMetaBox
============

[](#magicmetabox)

Helper class to generate wordpress metaboxes

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

[](#installation)

If you're using composer, run:

```
composer require mbv-media/magic-meta-box:*

```

Require composer `autoload.php` and add `use MagicMetaBox\MagicMetaBox;` to your plugins code.

Usage
-----

[](#usage)

### Create a metabox

[](#create-a-metabox)

Create new instance of MagicMetaBox

```
$myMetaBox = new MagicMetaBox(
    'my-metabox', // unique metabox id
    'My MetaBox title', // Metabox title
    array( 'post', 'page' ), // Metabox screens
    'prefix_' // Meta prefix,
    'side', // Metabox context (optional)
    'high', // Metabox priority (optional)
    true // Serialize values under the metabox id
);

```

### Add input fields

[](#add-input-fields)

Add a text input field to your new metabox:

```
$myMetaBox->addTextField(
    'my-text-field', // Input name
    array( // Additional attributes
        'class' => 'input-field'
    ),
    'My text field', // Associated label text
    'I am a default', // Default value
);

```

Add a textarea to your new metabox:

```
$myMetaBox->addTextAreaField(
    'my-text-arae', // Textarea name
    array(), // Additional attributes
    'My text area', // Associated label text
    'I am a default', // Default value
);

```

Add a checkbox to your new metabox:

```
$myMetaBox->addCheckboxField(
    'my-checkbox', // Checkbox name
    array(), // Additional attributes
    'My checkbox' // Associated label text
);

```

Add a select input to your new metabox:

```
$myMetaBox->addSelectField(
    'my-select', // Select name
    array( // Options
      0 => 'Yes',
      1 => 'No'
    ),
    true, // Multiple
    array( // Additional attributes
        'size' => 5
    ),
    'My select' // Associated label text
);

```

### Access meta data

[](#access-meta-data)

Access meta data via prefix + metabox id. Data is stored as array with input names as keys.

```
$meta = get_post_meta( $postId, 'prefix_my-metabox', true );
echo $meta['my-text-field'];

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~22 days

Total

5

Last Release

3828d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d29c858743fb9d04618c7feb75128beb3b92f72e96046f9aea22db6e1a7fed4e?d=identicon)[mbv\_media](/maintainers/mbv_media)

---

Top Contributors

[![hterhoeven](https://avatars.githubusercontent.com/u/142313079?v=4)](https://github.com/hterhoeven "hterhoeven (2 commits)")[![pdufour](https://avatars.githubusercontent.com/u/1239145?v=4)](https://github.com/pdufour "pdufour (2 commits)")

---

Tags

wordpressmetabox

### Embed Badge

![Health badge](/badges/mbv-media-magic-meta-box/health.svg)

```
[![Health](https://phpackages.com/badges/mbv-media-magic-meta-box/health.svg)](https://phpackages.com/packages/mbv-media-magic-meta-box)
```

###  Alternatives

[cmb2/cmb2

CMB2 is a metabox, custom fields, and forms library for WordPress that will blow your mind.

3.0k640.4k23](/packages/cmb2-cmb2)[webdevstudios/cmb2-attached-posts

Custom field for CMB2 for creating post relationships.

13565.5k](/packages/webdevstudios-cmb2-attached-posts)[webdevstudios/cmb2-post-search-field

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs.

6647.7k2](/packages/webdevstudios-cmb2-post-search-field)[webdevstudios/cpt-core

WordPress Custom Post Type OO wrapper

807.7k1](/packages/webdevstudios-cpt-core)[alexis-magina/cmb2-field-post-search-ajax

CMB2 field type to attach posts to each others. Search with Ajax.

3913.4k1](/packages/alexis-magina-cmb2-field-post-search-ajax)

PHPackages © 2026

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