default_category_post_types WordPress Filter Hook
The default_category_post_types hook is used to specify which post types should be included in the default category taxonomy. This hook is used in the following way: add_filter( 'default_category_post_types', 'my_default_category_post_types' ); function my_default_category_post_types( $post_types ) { // Add your post types here return $post_types; } In the example above, the my_default_category_post_types function is used to add one or more post types to the default category taxonomy. This function accepts an array of post types as its only argument and returns the modified array.
apply_filters( 'default_category_post_types', string[] $post_types ) #
Filters post types (in addition to ‘post’) that require a default category.
Parameters
- $post_types
(string[])An array of post type names. Default empty array.
Source
File: wp-includes/post.php
Changelog
Version | Description |
---|---|
5.5.0 | Introduced. |