WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
Line | Code |
---|---|
4752 |
|
4753 | if ( empty( $post_categories ) ) { |
4754 | /** |
4755 | * Filters post types (in addition to 'post') that require a default category. |
4756 | * |
4757 | * @since 5.5.0 |
4758 | * |
4759 | * @param string[] $post_types An array of post type names. Default empty array. |
4760 | */ |
4761 | $default_category_post_types = apply_filters( 'default_category_post_types', array() ); |
4762 |
|
4763 | // Regular posts always require a default category. |
4764 | $default_category_post_types = array_merge( $default_category_post_types, array( 'post' ) ); |
4765 |
|
4766 | if ( in_array( $post_type, $default_category_post_types, true ) |
4767 | && is_object_in_taxonomy( $post_type, 'category' ) |
4768 | && 'auto-draft' !== $post_status |
4769 | ) { |
4770 | $post_categories = array( get_option( 'default_category' ) ); |