WP Manifestindependent plugin directory
manifest / developer / wp-content-types-model

WP Content Types Model

WP Content Types Model is a starter model plugin for configuring WP Content Types.

by Bad Games · github.com/r-/wp-content-types-model

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/r-/wp-content-types-model/archive/refs/heads/main.zip

Starter model plugin for configuring WP Content Types.

This repository shows how to define site-specific post types, taxonomies, and fields using the wpct_config filter. It is intended to be copied, renamed, and adapted for your own project.

This plugin is intentionally inactive by default. It does not register demo content types automatically.

What This Is

  • A starter model plugin for WP Content Types.
  • A reference for using the wpct_config filter.
  • A safe place to show example post types, taxonomies, and field groups.
  • A template developers can copy, rename, and adapt.

What This Is Not

  • It is not required for WP Content Types to run.
  • It is not a production content model until adapted.
  • It is not a private production content model.
  • It does not include site-specific post types or settings.
  • It does not include analytics, consent, SEO, or noindex behavior.

Relationship To WP Content Types

wp-content-types is the reusable framework/engine. It reads configuration and registers content types.

wp-content-types-model is a starter model plugin showing how to provide configuration to that engine.

Your own site should usually have its own model plugin, copied and adapted from this starter.

Requirements

  • WordPress 6.5 or newer
  • PHP 8.0 or newer
  • WP Content Types, when you are ready to register an adapted model

The plugin activates safely without WP Content Types because it registers nothing by default.

How To Use

  1. Install or clone wp-content-types.
  2. Copy this repository or one of the example files.
  3. Rename the plugin for your own site or project.
  4. Adapt the post types, taxonomies, and fields.
  5. Register your model through the wpct_config filter.
  6. Activate your adapted model plugin.
  7. Visit Settings > Permalinks once after changing public slugs.

Examples

The /examples folder contains copyable model examples:

  • basic-book-model.php
  • portfolio-model.php
  • product-catalog-model.php

These files are not loaded automatically. Copy one into your own site model plugin, rename identifiers as needed, then adapt it.

Minimal Pattern

add_filter( 'wpct_config', function ( array $config ) {
    $config['post_types']['book'] = [
        'singular'   => 'Book',
        'plural'     => 'Books',
        'slug'       => 'books',
        'supports'   => [ 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ],
        'taxonomies' => [ 'book_genre' ],
        'args'       => [
            'menu_icon'    => 'dashicons-book',
            'has_archive'  => true,
            'show_in_rest' => true,
        ],
    ];

    $config['taxonomies']['book_genre'] = [
        'singular'    => 'Book Genre',
        'plural'      => 'Book Genres',
        'slug'        => 'book-genre',
        'object_type' => [ 'book' ],
        'args'        => [
            'hierarchical'      => true,
            'show_admin_column' => true,
            'show_in_rest'      => true,
        ],
    ];

    return $config;
} );

Optional Demo Mode

This plugin does not currently include a demo mode. A future release may add an explicit opt-in constant such as:

define( 'WPCT_MODEL_ENABLE_DEMO', true );

Until then, no examples are registered automatically.

What To Keep Private

Do not put production-only behavior in a public starter model unless it is intentionally reusable.

Keep these in your private site model:

  • production analytics configuration
  • consent configuration
  • SEO/noindex rules
  • deployment paths
  • private domains
  • site-specific integrations
  • business-specific post types or fields

License

GPL-2.0-or-later.