Filter hook 'register_post_type_args'

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

View Source

register_post_type_args

Filter Hook
Description
Filters the arguments for registering a post type.

Hook Information

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

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_args
add_filter('register_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:501 - How this hook is used in WordPress core
<?php
 496  		 *
 497  		 * @param array  $args      Array of arguments for registering a post type.
 498  		 *                          See the register_post_type() function for accepted arguments.
 499  		 * @param string $post_type Post type key.
 500  		 */
 501  		$args = apply_filters( 'register_post_type_args', $args, $this->name );
 502  
 503  		$post_type = $this->name;
 504  
 505  		/**
 506  		 * Filters the arguments for registering a specific post type.

PHP Documentation

<?php
/**
		 * Filters the arguments for registering a post type.
		 *
		 * @since 4.4.0
		 *
		 * @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.