Changeset 48480 for trunk/src/wp-includes/post.php
- Timestamp:
- 07/14/2020 04:39:44 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r48462 r48480 4037 4037 if ( 'auto-draft' !== $post_status ) { 4038 4038 foreach ( get_object_taxonomies( $post_type, 'object' ) as $taxonomy => $tax_object ) { 4039 if ( ! empty( $tax_object->default_term ) && ( empty( $postarr['tax_input'] ) || ! isset( $postarr['tax_input'][ $taxonomy ] ) ) ) { 4040 $postarr['tax_input'][ $taxonomy ] = array(); 4039 4040 if ( ! empty( $tax_object->default_term ) ) { 4041 4042 // Filter out empty terms. 4043 if ( isset( $postarr['tax_input'] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) { 4044 $postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] ); 4045 } 4046 4047 // Passed custom taxonomy list overwrites existing list if not empty. 4048 $terms = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) ); 4049 if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) { 4050 $postarr['tax_input'][ $taxonomy ] = $terms; 4051 } 4052 4053 if ( empty( $postarr['tax_input'][ $taxonomy ] ) ) { 4054 $default_term_id = get_option( 'default_taxonomy_' . $taxonomy ); 4055 if ( ! empty( $default_term_id ) ) { 4056 $postarr['tax_input'][ $taxonomy ] = array( (int) $default_term_id ); 4057 } 4058 } 4041 4059 } 4042 4060 }
Note: See TracChangeset
for help on using the changeset viewer.