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 |
---|---|
4841 |
|
4842 | if ( empty( $post_categories ) ) { |
4843 | /** |
4844 | * Filters post types (in addition to 'post') that require a default category. |
4845 | * |
4846 | * @since 5.5.0 |
4847 | * |
4848 | * @param string[] $post_types An array of post type names. Default empty array. |
4849 | */ |
4850 | $default_category_post_types = apply_filters( 'default_category_post_types', array() ); |
4851 |
|
4852 | // Regular posts always require a default category. |
4853 | $default_category_post_types = array_merge( $default_category_post_types, array( 'post' ) ); |
4854 |
|
4855 | if ( in_array( $post_type, $default_category_post_types, true ) |
4856 | && is_object_in_taxonomy( $post_type, 'category' ) |
4857 | && 'auto-draft' !== $post_status |
4858 | ) { |
4859 | $post_categories = array( get_option( 'default_category' ) ); |