Taxonomy_Manager::create_default_attachment_taxonomy_term()

Creates the default attachment taxonomy term if necessary.

Description

See also

Source

File: src/db-objects/taxonomy-manager.php

	protected function create_default_attachment_taxonomy_term() {
		$taxonomy_slug = $this->get_attachment_taxonomy_slug();
		if ( empty( $taxonomy_slug ) ) {
			return;
		}

		$options = $this->options()->get( 'general_settings', array() );
		if ( isset( $options['attachment_taxonomy_term_id'] ) ) {
			return;
		}

		$result = wp_insert_term( __( 'Form Upload', 'torro-forms' ), $taxonomy_slug );
		if ( is_wp_error( $result ) ) {
			return;
		}

		$options['attachment_taxonomy_term_id'] = (int) $result['term_id'];

		$this->options()->update( 'general_settings', $options );
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.