All features

Cherry Blossom feature

Content types: Post Types

Registers and exposes theme post type definitions.

Registers and exposes theme post type definitions.

Capabilities and extension points

Normalized post type objects.

  • var array|null

Registration and definition errors.

  • var array

Initializes the post type controller.

Registers post type hooks.

Registers configured post types.

Dispatches a completed post save to its registered definition.

  • param int $post_id Post ID.
  • param \WP_Post $post Post object.
  • param bool $update Whether an existing post was updated.
  • param \WP_Post|null $post_before Post object before the update, or null for new posts.

Dispatches insert data filtering to its registered definition.

  • param array $data Sanitized post data.
  • param array $postarr Post data with defaults applied.
  • param array $unsanitized_postarr Original post data.
  • param bool $update Whether an existing post is updated.
  • return array Filtered post data.

Dispatches admin list-table sorting to the matching definition.

  • param \WP_Query $query Query object.

Dispatches custom admin sorting SQL to the matching definition.

  • param array $clauses Query SQL clauses.
  • param \WP_Query $query Query object.
  • return array Filtered SQL clauses.

Gets a registered definition from the shared identity registry.

This also supports definitions created directly through Post_Type::get_instance().

  • param string $name Post type name.
  • return Post_Type|null Registered definition object.

Gets normalized post type objects.

  • return array Post type objects keyed by name.

Gets a normalized post type object.

  • param string $name Post type name.
  • return Post_Type|null Post type object.

Determines whether the controller owns a post type.

  • param string $name Post type name.
  • return bool Whether the post type exists.

Gets raw post type definitions.

  • return array Post type definitions.

Gets nested taxonomy definitions declared by post types.

  • return array Taxonomy definitions keyed by name.

Normalizes one post type definition.

  • param string|int $name Definition key.
  • param mixed $definition Definition data, class name, or unsupported value.
  • return Post_Type|null Normalized definition object.

Merges repeated nested taxonomy associations.

The first structural definition remains canonical. Later post types only extend its object type associations.

  • param array $existing Existing definition.
  • param array $incoming Incoming definition.
  • param string $name Taxonomy name.
  • return array Merged definition.

Normalizes a definition for order-independent structural comparison.

  • param mixed $value Definition value.
  • return mixed Normalized value.

Records a controller error.

  • param string $name Definition name.
  • param \WP_Error $error Error object.

Gets controller errors.

  • return array Errors keyed by post type name.

Source reference

This editable reference page is based on the PHP documentation in content-types/class-post-types.php.