classes/PodsAPI.php
public function save_term( $term_data, $term_meta, $strict = false, $sanitized = false, $fields = array() ) {

		if ( empty( $term_data['taxonomy'] ) ) {
			return 0;
		}

		$conflicted = pods_no_conflict_check( 'taxonomy' );

		if ( ! is_array( $term_data ) || empty( $term_data ) ) {
			$term_data = array( 'name' => '' );
		}

		if ( ! $conflicted ) {
			pods_no_conflict_on( 'taxonomy' );
		}

		if ( ! is_array( $term_meta ) ) {
			$term_meta = array();
		}

		if ( $sanitized ) {
			$term_data = pods_unsanitize( $term_data );
			$term_meta = pods_unsanitize( $term_meta );
		}

		$taxonomy = $term_data['taxonomy'];

		unset( $term_data['taxonomy'] );

		if ( empty( $term_data['term_id'] ) ) {
			$term_name = $term_data['name'];

			unset( $term_data['name'] );

			$term_data['term_id'] = wp_insert_term( $term_name, $taxonomy, $term_data );
		} elseif ( 1 < count( $term_data ) ) {
			$term_data['term_id'] = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
		}

		if ( is_wp_error( $term_data['term_id'] ) ) {
			if ( ! $conflicted ) {
				pods_no_conflict_off( 'taxonomy' );
			}

			/**
			 * @var $term_error WP_Error
			 */
			$term_error = $term_data['term_id'];

			return pods_error( $term_error->get_error_message(), $this );
		} elseif ( is_array( $term_data['term_id'] ) ) {
			$term_data['term_id'] = $term_data['term_id']['term_id'];
		}

		$this->save_term_meta( $term_data['term_id'], $term_meta, $strict, $fields );

		if ( ! $conflicted ) {
			pods_no_conflict_off( 'taxonomy' );
		}

		return $term_data['term_id'];
	}
public function save_term( $term_data, $term_meta, $strict = false, $sanitized = false, $fields = array() ) {

		if ( empty( $term_data['taxonomy'] ) ) {
			return 0;
		}

		$conflicted = pods_no_conflict_check( 'taxonomy' );

		if ( ! is_array( $term_data ) || empty( $term_data ) ) {
			$term_data = array( 'name' => '' );
		}

		if ( ! $conflicted ) {
			pods_no_conflict_on( 'taxonomy' );
		}

		if ( ! is_array( $term_meta ) ) {
			$term_meta = array();
		}

		if ( $sanitized ) {
			$term_data = pods_unsanitize( $term_data );
			$term_meta = pods_unsanitize( $term_meta );
		}

		$taxonomy = $term_data['taxonomy'];

		unset( $term_data['taxonomy'] );

		if ( empty( $term_data['term_id'] ) ) {
			$term_name = $term_data['name'];

			unset( $term_data['name'] );

			$term_data['term_id'] = wp_insert_term( $term_name, $taxonomy, $term_data );
		} elseif ( 1 < count( $term_data ) ) {
			$term_data['term_id'] = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
		}

		if ( is_wp_error( $term_data['term_id'] ) ) {
			if ( ! $conflicted ) {
				pods_no_conflict_off( 'taxonomy' );
			}

			/**
			 * @var $term_error WP_Error
			 */
			$term_error = $term_data['term_id'];

			return pods_error( $term_error->get_error_message(), $this );
		} elseif ( is_array( $term_data['term_id'] ) ) {
			$term_data['term_id'] = $term_data['term_id']['term_id'];
		}

		$this->save_term_meta( $term_data['term_id'], $term_meta, $strict, $fields );

		if ( ! $conflicted ) {
			pods_no_conflict_off( 'taxonomy' );
		}

		return $term_data['term_id'];
	}
public function save_term ( $ term_data , $ term_meta , $ strict = false , $ sanitized = false , $ fields = array ( ) ) { if ( empty ( $ term_data [ 'taxonomy' ] ) ) { return 0 ; } $ conflicted = pods_no_conflict_check ( 'taxonomy' ) ; if ( ! is_array ( $ term_data ) || empty ( $ term_data ) ) { $ term_data = array ( 'name' => '' ) ; } if ( ! $ conflicted ) { pods_no_conflict_on ( 'taxonomy' ) ; } if ( ! is_array ( $ term_meta ) ) { $ term_meta = array ( ) ; } if ( $ sanitized ) { $ term_data = pods_unsanitize ( $ term_data ) ; $ term_meta = pods_unsanitize ( $ term_meta ) ; } $ taxonomy = $ term_data [ 'taxonomy' ] ; unset ( $ term_data [ 'taxonomy' ] ) ; if ( empty ( $ term_data [ 'term_id' ] ) ) { $ term_name = $ term_data [ 'name' ] ; unset ( $ term_data [ 'name' ] ) ; $ term_data [ 'term_id' ] = wp_insert_term ( $ term_name , $ taxonomy , $ term_data ) ; } elseif ( 1 < count ( $ term_data ) ) { $ term_data [ 'term_id' ] = wp_update_term ( $ term_data [ 'term_id' ] , $ taxonomy , $ term_data ) ; } if ( is_wp_error ( $ term_data [ 'term_id' ] ) ) { if ( ! $ conflicted ) { pods_no_conflict_off ( 'taxonomy' ) ; } /**
			 * @var $term_error WP_Error
			 */ $ term_error = $ term_data [ 'term_id' ] ; return pods_error ( $ term_error -> get_error_message ( ) , $ this ) ; } elseif ( is_array ( $ term_data [ 'term_id' ] ) ) { $ term_data [ 'term_id' ] = $ term_data [ 'term_id' ] [ 'term_id' ] ; } $ this -> save_term_meta ( $ term_data [ 'term_id' ] , $ term_meta , $ strict , $ fields ) ; if ( ! $ conflicted ) { pods_no_conflict_off ( 'taxonomy' ) ; } return $ term_data [ 'term_id' ] ; }
Save a taxonomy's term

@param array $term_data All term data to be saved (using wp_insert_term / wp_update_term)
@param array $term_meta All meta to be saved (set value to null to delete)
@param bool  $strict    (optional) Whether to delete previously saved meta not in $post_meta
@param bool  $sanitized (optional) Will unsanitize the data, should be passed if the data is sanitized before
sending.
@param array $fields    (optional) The array of fields and their options, for further processing with

@return int Term ID

@since 2.0.0
Save a taxonomy s term