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 |
---|---|
4953 |
|
4954 | if ( empty( $post_categories ) ) { |
4955 | /** |
4956 | * Filters post types (in addition to 'post') that require a default category. |
4957 | * |
4958 | * @since 5.5.0 |
4959 | * |
4960 | * @param string[] $post_types An array of post type names. Default empty array. |
4961 | */ |
4962 | $default_category_post_types = apply_filters( 'default_category_post_types', array() ); |
4963 |
|
4964 | // Regular posts always require a default category. |
4965 | $default_category_post_types = array_merge( $default_category_post_types, array( 'post' ) ); |
4966 |
|
4967 | if ( in_array( $post_type, $default_category_post_types, true ) |
4968 | && is_object_in_taxonomy( $post_type, 'category' ) |
4969 | && 'auto-draft' !== $post_status |
4970 | ) { |
4971 | $post_categories = array( get_option( 'default_category' ) ); |