Posttypes Taxonomies

Registering via JSON

Both CPTs and taxonomies live in their respective config files. PorterWP validates, merges defaults, and calls register_post_type() / register_taxonomy() during the init action.

Feature
File
Hook

Post Types

posttypes.json

Porter_Config_Posttypes

Taxonomies

taxonomies.json

Porter_Config_Taxonomies

Auto Labels

If you omit the labels object, PorterWP generates a full label set from the slug (e.g. projectProject, Projects, Add new Project, etc.).

Icon SVG

When you save posttypes.json, Gulp fires generateCptIcons() and writes:

porter/inc/posttypes/{slug}/icon.svg

WordPress’ list table and Site Editor then render the icon automatically.


Relationships

Add taxonomies inside a CPT, or object_type inside a taxonomy to connect them.

# posttypes.json
{
  "project": {
    "taxonomies": ["topic", "status"]
  }
}
# taxonomies.json
{
  "status": {
    "object_type": ["project"]
  }
}

Last updated