registered_post_type WordPress Action Hook

The registered_post_type hook is one of the most important hooks in WordPress. It is used to register custom post types with WordPress. This hook is called when a custom post type is first registered. It allows for the registration of custom post types to be modified.

do_action( 'registered_post_type', string $post_type, WP_Post_Type $post_type_object ) #

Fires after a post type is registered.


Parameters

$post_type

(string)Post type.

$post_type_object

(WP_Post_Type)Arguments used to register the post type.


Top ↑

More Information

We can register a custom post type with the register_post_type function. This should not be hooked before init. So, the good option is to call it with an init hook.

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 the argument for a complete list of supported features.


Top ↑

Source

File: wp-includes/post.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.6.0Converted the $post_type parameter to accept a WP_Post_Type object.
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More