PHPackages                             waughj/wp-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. waughj/wp-meta-box

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

waughj/wp-meta-box
==================

Simple class for easily adding meta boxes for WordPress admin editors.

v0.3.0(6y ago)01552AGPL-3.0-or-laterPHPPHP &gt;=7.2

Since Jun 4Pushed 6y agoCompare

[ Source](https://github.com/waughjai/wp-meta-box)[ Packagist](https://packagist.org/packages/waughj/wp-meta-box)[ RSS](/packages/waughj-wp-meta-box/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (2)Versions (9)Used By (2)

WP Meta Box
===========

[](#wp-meta-box)

Simple class for easily adding meta boxes for WordPress admin editors.

Use
---

[](#use)

You just need to create an instance o' this class before the admin loads &amp; the constructor will automatically call all the WordPress functions needed to set a meta box up.

1st 2 mandatory arguments to constructor are the identifying slug &amp; public title shown in editor. The optional 3rd argument is a hash map o' extra arguments.

- "post-type": Array o' post types this should show up in. Default is array with just "page".
- "input-type": String specifying type o' input HTML to form in the editor:
    - The default is "text".
    - 'Cept for the following exceptions, the any value will create an input tag with the type set to the given type. Thus, "number", "tel", "email", "password", &amp; other HTML input types will work.
    - "textarea" will create a textarea tag.
    - "select" will create a select tag. Also requires optional argument "values", which should be an array o' hash maps with "id" &amp; "name" key values. When used, the "id" value will be the actual value saved into the database, while the "name" value will show in the select box.
    - "day-of-the-week" will automatically create a select without needing the "values" argument. Values will be set to the 7 days o' week, whose IDs will be the #s 0 to 6 for Monday to Sunday.

Example
-------

[](#example)

```
use WaughJ\WPMetaBox\WPMetaBox;

new WPMetaBox
(
	'color',
	'Color',
	[
		'post-type' => 'news-post',
		'input-type' => 'select',
		'values' =>
		[
			[ 'id' => '0', 'name' => 'Red' ],
			[ 'id' => '1', 'name' => 'Blue' ],
			[ 'id' => '2', 'name' => 'Green' ]
		]
	]
);

```

Changelog
---------

[](#changelog)

### 0.3.0

[](#030)

- Change input IDs to have “-input” appended to them to prevent collision with outer box
    - WordPress automatically applies our the meta box slug to the outer box of the input box beyond our control, so we have to change the ID of the inner input box to prevent multiple elements with the same ID, which is invalid HTML

### 0.2.1

[](#021)

- Update TestHashItem dependency

### 0.2.0

[](#020)

- Add getValue Method

### 0.1.4

[](#014)

- Fix Saving

### 0.1.3

[](#013)

- Fix Missing Use Statement Bug
    - Missing "use" statement caused constructor to fail

### 0.1.2

[](#012)

- Fix Example in Readme
    - Example didn't use "use" statement to include full class name with namespace, which in most cases will cause an error in code if used. This adds the "use" statement to the example for better clarification

### 0.1.1

[](#011)

- Improve Argument Name &amp; Readme
    - Change "page-type" argument to "post-type" to make it mo' consistent &amp; predictable with WordPress name for concept
    - Also adds detailed instructions to readme

### 0.1.0

[](#010)

- Initial Version

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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 ~37 days

Recently: every ~65 days

Total

8

Last Release

2275d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11161078?v=4)[waughj](/maintainers/waughj)[@waughj](https://github.com/waughj)

---

Tags

wordpressmetameta-box

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/waughj-wp-meta-box/health.svg)

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

###  Alternatives

[wpmetabox/meta-box

The most powerful &amp; comprehensive plugin to create, manage, show and connect dynamic data with forms and custom fields effortlessly on WordPress.

1.2k20.5k3](/packages/wpmetabox-meta-box)[rilwis/meta-box

The most powerful &amp; comprehensive plugin to create, manage, show and connect dynamic data with forms and custom fields effortlessly on WordPress.

1.2k1.8k1](/packages/rilwis-meta-box)[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)

PHPackages © 2026

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