Action hook 'registered_post_type'

in WP Core File wp-includes/post.php at line 1828

View Source

registered_post_type

Action Hook
Description
Fires after a post type is registered.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Action
Line Number 1828

Hook Parameters

Type Name Description
string $post_type Post type.
WP_Post_Type $post_type_object Arguments used to register the post type.

Usage Examples

Basic Usage
<?php
// Hook into registered_post_type
add_action('registered_post_type', 'my_custom_function', 10, 2);

function my_custom_function($post_type, $post_type_object) {
    // Your custom code here
}

Source Code Context

wp-includes/post.php:1828 - How this hook is used in WordPress core
<?php
1823  	 * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object.
1824  	 *
1825  	 * @param string       $post_type        Post type.
1826  	 * @param WP_Post_Type $post_type_object Arguments used to register the post type.
1827  	 */
1828  	do_action( 'registered_post_type', $post_type, $post_type_object );
1829  
1830  	/**
1831  	 * Fires after a specific post type is registered.
1832  	 *
1833  	 * The dynamic portion of the filter name, `$post_type`, refers to the post type key.

PHP Documentation

<?php
/**
	 * Fires after a post type is registered.
	 *
	 * @since 3.3.0
	 * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object.
	 *
	 * @param string       $post_type        Post type.
	 * @param WP_Post_Type $post_type_object Arguments used to register the post type.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.