PHPackages                             alexrah/wp-admin-custom-post-types - 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. alexrah/wp-admin-custom-post-types

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

alexrah/wp-admin-custom-post-types
==================================

Requires a Wordpress installation. Helper Classes to create Wordpress Custom Post Types, Post Meta, Custom Taxonomies

4.0.1(1mo ago)1251MITPHPPHP &gt;=7.0.0

Since Oct 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/alexrah/wp-admin-custom-post-types)[ Packagist](https://packagist.org/packages/alexrah/wp-admin-custom-post-types)[ Docs](https://github.com/alexrah/wp-admin-custom-post-types)[ RSS](/packages/alexrah-wp-admin-custom-post-types/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (17)Used By (0)

About
-----

[](#about)

Helper class to register custom post\_types and relative post\_metas to Wordpress

Install using composer:
-----------------------

[](#install-using-composer)

```
composer require alexrah/wp-admin-custom-post-types
```

published on packagist at:

Usage
-----

[](#usage)

```
use WpAdminCPT\RegisterTypes;
use WpAdminCPT\MetaFieldsManager;
use WpAdminCPT\MetaFieldsAdmin;

const META_BOX_NONCE = 'meta_box_nonce';

new RegisterTypes('user-paid-content',
	[
		'label_singular' => "My Post",
		'label_plural' => "My Posts"
	],
	true,
	[
		'label_singular' => "Categoria Contenuto",
		'label_plural' => "Categorie Contenuto"
	]
);

function vn_fields(): MetaFieldsManager {

	$sPrefix = 'user-paid-';

	$aFields = [
		[
			"Name"        => "type",
			"Label"       => "Tipo Contenuto",
			"LabelPublic" => "",
			"Placeholder" => "Seleziona Tipo",
			"Type"        => "select",
			"Validation"  => '',
			"Value"       => ['job-listing','event'],
			'Group'       => 'global'
		],
		[
			"Name"        => "candidati_comunali",
			"Label"       => "Candidati Consiglieri",
			"LabelPublic" => "",
			"Placeholder" => "",
			"Type"        => "data-grid",
			"Validation"  => '',
			"Group"       => 'global',
			"Value"       => [
				[
					'type' => 'text',
					'name' => 'nome',
					'label' => "Nome"
				],
				[
					'type' => 'text',
					'name' => 'cognome',
					'label' => "Cognome"
				],
				[
					'type' => 'text',
					'name' => 'voti',
					'label' => "Voti"
				],
				[
					'type' => 'checkbox',
					'name' => 'isEletto',
					'label' => "Eletto"
				]
			]

		]
	];

	return new MetaFieldsManager($sPrefix,$aFields);

}

$oUserPaidContent = new MetaFieldsAdmin(vn_fields()->getFields(),META_BOX_NONCE,['user-paid-content'],'Dati');
$oUserPaidContent->init();

```

### RegisterTypes options

[](#registertypes-options)

- `string $screen` post\_type screen IDs
- `array $args_post` arguments to pass for registering post\_types
    - `label_singular` string used for labels and define capability
    - `label_plural` string used for labels and define capability
    - `menu_icon` string dashicons class
    - `slug` string for custom rewrite rule
    - `taxonomies` array of taxonomy slugs
    - `show_in_menu` bool|string ie. edit.php?post\_type=evento
    - `supports` array ie. 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'
    - `has_archive` bool|string - Whether there should be post type archives, or if a string, the archive slug to use. Will generate the proper rewrite rules if $rewrite is enabled. Default false
    - `bool $register_tax` whether use screens IDs to register taxonomy
    - `array $args_tax` arguments to pass for registering taxonomy
    - `label_singular` string used for labels
    - `label_plural` string used for labels
    - `cat_name` string used to register taxonomy, if not specified use cat-$screens
    - `linked_types` (array|string) object types with which the taxonomy should be associated, Default to $screen
    - `hierarchical` bool Whether the taxonomy is hierarchical. Default true
    - `slug` string Customize the permalink slug. Default to cat-$screen
- `bool $register_tax` whether use screens IDs to register taxonomy
- `array $args_tax` arguments to pass for registering taxonomy
    - `label_singular` string used for labels
    - `label_plural` string used for labels
    - `cat_name` string used to register taxonomy, if not specified use cat-$screens
    - `linked_types` (array|string) object types with which the taxonomy should be associated, Default to $screen
    - `hierarchical` bool Whether the taxonomy is hierarchical. Default true
    - `slug` string Customize the permalink slug. Default to cat-$screen

### MetaFieldsAdmin options

[](#metafieldsadmin-options)

- `array $aMetaFields` array of meta\_fields as returned by `MetaFieldsManager::getFields()`
- `string $sNonce` a unique string used to validate requests
- `array $aScreens` an array of post\_type IDs to register with
- `string $sBoxTitle` a label for the meta\_box

#### NB: go to /wp-admin/users.php?page=users-user-role-editor.php to update permissions

[](#nb-go-to-wp-adminusersphppageusers-user-role-editorphp-to-update-permissions)

Changelog
---------

[](#changelog)

#### version 1.0.0

[](#version-100)

- helper classes to register post\_types
- supports creating custom taxonomies
- support creating post\_metas

#### version 2.0.0

[](#version-200)

change root dir for PHP classes from src to backend

#### version 2.1.0

[](#version-210)

add support to Rest API

#### Version 3.0

[](#version-30)

new post\_meta type = data-grid -&gt; React UX to manage multi-dimensional array data in a single post\_meta

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance91

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

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

Recently: every ~191 days

Total

16

Last Release

43d ago

Major Versions

0.4.0 → 1.0.02022-10-26

1.2.0 → 2.0.02022-11-15

2.3.0 → 3.0.02024-04-03

3.1.0 → 4.0.02026-03-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/19648e66952936c124a58d9b115cf982047c8b58791c0045e95ff8dfb9cb416c?d=identicon)[alexrah](/maintainers/alexrah)

---

Top Contributors

[![alexrah](https://avatars.githubusercontent.com/u/905490?v=4)](https://github.com/alexrah "alexrah (62 commits)")

---

Tags

wordpresswpcptwp-adminpost metacustom-post-typescustom-taxonomy

### Embed Badge

![Health badge](/badges/alexrah-wp-admin-custom-post-types/health.svg)

```
[![Health](https://phpackages.com/badges/alexrah-wp-admin-custom-post-types/health.svg)](https://phpackages.com/packages/alexrah-wp-admin-custom-post-types)
```

###  Alternatives

[roots/bedrock

WordPress boilerplate with Composer, easier configuration, and an improved folder structure

6.5k441.8k2](/packages/roots-bedrock)[ffraenz/private-composer-installer

A composer install helper for private packages

2331.7M5](/packages/ffraenz-private-composer-installer)[log1x/poet

Configuration-based post type, taxonomy, editor color palette, block category, and block registration for Sage 10.

218280.1k1](/packages/log1x-poet)[tareq1988/wordpress-settings-api-class

WordPress settings API Abstraction Class

46611.1k3](/packages/tareq1988-wordpress-settings-api-class)[proteusthemes/wp-customizer-utilities

Advanced WordPress customizer controls and settings for better user experience.

329.4k1](/packages/proteusthemes-wp-customizer-utilities)[typisttech/wp-option-store

Extending WordPress Options API, read options from places other than database, the OOP way

1517.3k2](/packages/typisttech-wp-option-store)

PHPackages © 2026

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