PHPackages                             vunamhung/cmb2\_select2 - 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. vunamhung/cmb2\_select2

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

vunamhung/cmb2\_select2
=======================

This is a CMB2 Extension repository which help modify the default behavior of CMB2 and extends it's functionality.

1.0.2(6y ago)1147[1 issues](https://github.com/vunamhung/cmb2_select2/issues)[1 PRs](https://github.com/vunamhung/cmb2_select2/pulls)GPL-3.0+PHPPHP &gt;=5.6.0

Since Feb 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/vunamhung/cmb2_select2)[ Packagist](https://packagist.org/packages/vunamhung/cmb2_select2)[ Docs](https://github.com/vunamhung/cmb2_select2)[ RSS](/packages/vunamhung-cmb2-select2/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (6)Used By (0)

CMB2 Field Type: Select2
========================

[](#cmb2-field-type-select2)

Description
-----------

[](#description)

[Select2](https://select2.github.io/) field type for [CMB2](https://github.com/WebDevStudios/CMB2 "Custom Metaboxes and Fields for WordPress 2").

This plugin gives you two additional field types based on Select2:

1. The `select2` field acts much like the default `select` field. However, it adds typeahead-style search allowing you to quickly make a selection from a large list
2. The `multiselect2` field allows you to select multiple values with typeahead-style search. The values can be dragged and dropped to reorder

Usage
-----

[](#usage)

`select2` - Select box with with typeahead-style search. Example:

```
$cmb->add_field( array(
	'name'    => 'Cooking time',
	'id'      => $prefix . 'cooking_time',
	'desc'    => 'Cooking time',
	'type'    => 'select2',
	'options' => array(
		'5'  => '5 minutes',
		'10' => '10 minutes',
		'30' => 'Half an hour',
		'60' => '1 hour',
	),
) );
```

`multiselect2` - Multi-value select box with drag and drop reordering. Example:

```
$cmb->add_field( array(
	'name'    => 'Ingredients',
	'id'      => $prefix . 'ingredients',
	'desc'    => 'Select ingredients. Drag to reorder.',
	'type'    => 'multiselect2',
	'options' => array(
		'flour'  => 'Flour',
		'salt'   => 'Salt',
		'eggs'   => 'Eggs',
		'milk'   => 'Milk',
		'butter' => 'Butter',
	),
) );
```

### Placeholder

[](#placeholder)

You can specify placeholder text through the attributes array. Example:

```
$cmb->add_field( array(
	'name'    => 'Ingredients',
	'id'      => $prefix . 'ingredients',
	'desc'    => 'Select this recipes ingredients.',
	'type'    => 'multiselect2',
	'options' => array(
		'flour'  => 'Flour',
		'salt'   => 'Salt',
		'eggs'   => 'Eggs',
		'milk'   => 'Milk',
		'butter' => 'Butter',
	),
	'attributes' => array(
		'placeholder' => 'Select ingredients. Drag to reorder'
	),
) );
```

### Custom Select2 configuration and overriding default configuration options

[](#custom-select2-configuration-and-overriding-default-configuration-options)

You can define Select2 configuration options using HTML5 `data-*` attributes. It's worth reading up on the [available options](https://select2.github.io/options.html#data-attributes) over on the Select2 website. Example:

```
$cmb->add_field( array(
	'name'    => 'Ingredients',
	'id'      => $prefix . 'ingredients',
	'desc'    => 'Select ingredients. Drag to reorder.',
	'type'    => 'multiselect2',
	'options' => array(
		'flour'  => 'Flour',
		'salt'   => 'Salt',
		'eggs'   => 'Eggs',
		'milk'   => 'Milk',
		'butter' => 'Butter',
	),
	'attributes' => array(
		'data-maximum-selection-length' => '2',
	),
) );
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~11 days

Total

3

Last Release

2266d ago

### Community

Maintainers

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

---

Top Contributors

[![vunamhung](https://avatars.githubusercontent.com/u/59323806?v=4)](https://github.com/vunamhung "vunamhung (9 commits)")

---

Tags

wordpressselect2CMB2cmb2\_select2

### Embed Badge

![Health badge](/badges/vunamhung-cmb2-select2/health.svg)

```
[![Health](https://phpackages.com/badges/vunamhung-cmb2-select2/health.svg)](https://phpackages.com/packages/vunamhung-cmb2-select2)
```

###  Alternatives

[php-stubs/wordpress-stubs

WordPress function and class declaration stubs for static analysis.

19013.0M263](/packages/php-stubs-wordpress-stubs)[wpsitecare/carelib

A collection of helpful functions to make creating an awesome theme more enjoyable.

164.6k](/packages/wpsitecare-carelib)[bostondv/bootstrap-ninja-forms

Adds Bootstrap classes to Ninja Forms

222.2k](/packages/bostondv-bootstrap-ninja-forms)

PHPackages © 2026

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