Filter hook 'register_{$post_type}_post_type_args'

in WP Core File wp-includes/class-wp-post-type.php at line 522

View Source

register_{$post_type}_post_type_args

Filter Hook
Description
Filters the arguments for registering a specific post type. The dynamic portion of the filter name, `$post_type`, refers to the post type key. Possible hook names include: - `register_post_post_type_args` - `register_page_post_type_args`

Hook Information

File Location wp-includes/class-wp-post-type.php View on GitHub
Hook Type Filter
Line Number 522

Hook Parameters

Type Name Description
array $args Array of arguments for registering a post type. See the register_post_type() function for accepted arguments.
string $post_type Post type key.

Usage Examples

Basic Usage
<?php
// Hook into register_{$post_type}_post_type_args
add_filter('register_{$post_type}_post_type_args', 'my_custom_filter', 10, 2);

function my_custom_filter($args, $post_type) {
    // Your custom filtering logic here
    return $args;
}

Source Code Context

wp-includes/class-wp-post-type.php:522 - How this hook is used in WordPress core
<?php
 517  		 *
 518  		 * @param array  $args      Array of arguments for registering a post type.
 519  		 *                          See the register_post_type() function for accepted arguments.
 520  		 * @param string $post_type Post type key.
 521  		 */
 522  		$args = apply_filters( "register_{$post_type}_post_type_args", $args, $this->name );
 523  
 524  		$has_edit_link = ! empty( $args['_edit_link'] );
 525  
 526  		// Args prefixed with an underscore are reserved for internal use.
 527  		$defaults = array(

PHP Documentation

<?php
/**
		 * Filters the arguments for registering a specific post type.
		 *
		 * The dynamic portion of the filter name, `$post_type`, refers to the post type key.
		 *
		 * Possible hook names include:
		 *
		 *  - `register_post_post_type_args`
		 *  - `register_page_post_type_args`
		 *
		 * @since 6.0.0
		 * @since 6.4.0 Added `late_route_registration`, `autosave_rest_controller_class` and `revisions_rest_controller_class` arguments.
		 *
		 * @param array  $args      Array of arguments for registering a post type.
		 *                          See the register_post_type() function for accepted arguments.
		 * @param string $post_type Post type key.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-post-type.php
Related Hooks

Related hooks will be displayed here in future updates.