arraypress/wp-register-content-types

Register WordPress post types and taxonomies with labels that use their own name, generated from a singular and a plural.

Maintainers

Package info

github.com/arraypress/wp-register-content-types

pkg:composer/arraypress/wp-register-content-types

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-25 15:44 UTC

This package is auto-updated.

Last update: 2026-08-26 19:47:19 UTC


README

Register a post type or taxonomy from its singular name, and get all thirty-odd labels written for you.

What it does

register_post_type() takes a labels array with more than thirty entries. Nobody fills it in. The usual result is a plugin whose admin says "Add New Post" on a screen for books, "No posts found" when there are no books, and "Post updated" after saving one.

Give this the singular and plural, and every label is generated with the right word in it — including the ones nobody remembers, like the media frame's "Set featured image" and the block editor's "Post published" toast.

Features

  • Get every label written from a singular and plural name, not just the obvious ones
  • Register taxonomies alongside their post type, in the same call
  • Keep the labels translatable, in your plugin's own text domain
  • Set an icon, supports and visibility without leaving the array
  • Override any individual label that needs different wording
  • Skip the fifty lines of boilerplate each type would otherwise need

Installation

composer require arraypress/wp-register-content-types

Quick start

add_action( 'init', function () {
	register_content_type( 'book', [
		'singular'   => 'Book',
		'icon'       => 'book-alt',
		'taxonomies' => [
			'genre' => [ 'singular' => 'Genre', 'hierarchical' => true ],
			'mood'  => [ 'singular' => 'Mood' ],
		],
	] );
} );

That is a working post type with correct labels throughout the admin, and two taxonomies attached to it.

Requirements

  • PHP 8.3 or later
  • WordPress 7.1 or later

License

GPL-2.0-or-later