Changeset 48043 for trunk/src/wp-includes/post.php
- Timestamp:
- 06/14/2020 09:40:10 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r47922 r48043 4690 4690 * Set categories for a post. 4691 4691 * 4692 * If the post categories parameter is not set, then the default category is 4693 * going used. 4692 * If no categories are provided, the default category is used. 4694 4693 * 4695 4694 * @since 2.1.0 … … 4707 4706 $post_type = get_post_type( $post_ID ); 4708 4707 $post_status = get_post_status( $post_ID ); 4709 // If $post_categories isn't already an array, make it one: 4708 4709 // If $post_categories isn't already an array, make it one. 4710 4710 $post_categories = (array) $post_categories; 4711 4711 4712 if ( empty( $post_categories ) ) { 4712 if ( 'post' === $post_type && 'auto-draft' !== $post_status ) { 4713 /** 4714 * Filters post types (in addition to 'post') that require a default category. 4715 * 4716 * @since 5.5.0 4717 * 4718 * @param array $post_types An array of post types. Default empty array. 4719 */ 4720 $default_category_post_types = apply_filters( 'default_category_post_types', array() ); 4721 4722 // Regular posts always require a default category. 4723 $default_category_post_types = array_merge( $default_category_post_types, array( 'post' ) ); 4724 4725 if ( in_array( $post_type, $default_category_post_types, true ) 4726 && is_object_in_taxonomy( $post_type, 'category' ) 4727 && 'auto-draft' !== $post_status 4728 ) { 4713 4729 $post_categories = array( get_option( 'default_category' ) ); 4714 4730 $append = false;
Note: See TracChangeset
for help on using the changeset viewer.