register_post_type ( $post_type, $args = array() )

  • (string) $post_type Post type key. Must not exceed 20 characters and may only contain lowercase alphanumeric characters, dashes, and underscores. See sanitize_key().
  • (array|string) $args { Array or string of arguments for registering a post type.
  • (WP_Post_Type|WP_Error) The registered post type object, or an error object.
Defined at:
Change Log:
  • 3: .
  • 4: .
  • 4: .
  • 4: .
  • 5: .


Registers a post type.

Note: Post type registrations should not be hooked before the {@see 'init'} action. Also, any taxonomy connections should be registered via the $taxonomies argument to ensure consistency when hooks such as {@see 'parse_query'} or {@see 'pre_get_posts'} are used.

Post types can support any number of built-in core features such as meta boxes, custom fields, post thumbnails, post statuses, comments, and more. See the $supports argument for a complete list of supported features.

Related Functions

unregister_post_type, register_post_meta, register_block_type, register_post_status, unregister_post_meta

Top Google Results

User discussions

wpseek mobile