Skip to content

Commit

Permalink
Improve empty description validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Memo committed Mar 5, 2024
1 parent 717b9da commit 12bedb8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ function pri_fgd2wp_pre_insert_taxonomy_term( $custom_field_values, $new_term_id
case 'category-body':
if ( $custom_field_values && ! empty( $custom_field_values[0] ) ) {
$cat_description = get_term_field( 'description', $new_term_id, 'category', 'raw' );
if ( is_string( $cat_description ) && empty( trim( $cat_description ) ) && ! empty( $custom_field_values[0]['field_body_value'] ) ) {
$cat_description_is_valid = is_string( $cat_description ) && ! empty( trim( $cat_description ) );
if ( ! $cat_description_is_valid && ! empty( $custom_field_values[0]['field_body_value'] ) ) {
$args['description'] = $custom_field_values[0]['field_body_value'];
wp_update_term( $new_term_id, 'category', $args );
}
Expand Down

0 comments on commit 12bedb8

Please sign in to comment.