Action hook 'registered_post_type_{$post_type}'

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

View Source

registered_post_type_{$post_type}

Action Hook
Description
Fires after a specific post type is registered. The dynamic portion of the filter name, `$post_type`, refers to the post type key. Possible hook names include: - `registered_post_type_post` - `registered_post_type_page`

Hook Information

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

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_{$post_type}
add_action('registered_post_type_{$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:1845 - How this hook is used in WordPress core
<?php
1840  	 * @since 6.0.0
1841  	 *
1842  	 * @param string       $post_type        Post type.
1843  	 * @param WP_Post_Type $post_type_object Arguments used to register the post type.
1844  	 */
1845  	do_action( "registered_post_type_{$post_type}", $post_type, $post_type_object );
1846  
1847  	return $post_type_object;
1848  }
1849  
1850  /**

PHP Documentation

<?php
/**
	 * Fires after a specific post type is registered.
	 *
	 * The dynamic portion of the filter name, `$post_type`, refers to the post type key.
	 *
	 * Possible hook names include:
	 *
	 *  - `registered_post_type_post`
	 *  - `registered_post_type_page`
	 *
	 * @since 6.0.0
	 *
	 * @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.