Filters the arguments for registering a post type.
Parameters
$argsarray- Array of arguments for registering a post type.
See the register_post_type() function for accepted arguments.More Arguments from register_post_type( … $args )
Post type registration arguments. $post_typestring- Post type key.
Source
$args = apply_filters( 'register_post_type_args', $args, $this->name );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |
Example of Custom Post Type args change via filter hook. Changing rewrite slug from
moviestofilms:You can also use `register_{$post_type}_post_type_args` to target a specific post type.
For example, you can use `register_post_post_type_args` to target only the Post post type and modify how it’s registered:
register_{$post_type}_post_type_argsis called after the filterregister_post_type_argsand thus can overwrite possible changes of the first one!