Taxonomy_Manager::maybe_register_attachment_category_taxonomy()

Registers the attachment category taxonomy if necessary.

Description

See also

Source

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

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

		$this->attachment_taxonomy_slug = $taxonomy_slug;

		if ( taxonomy_exists( $taxonomy_slug ) ) {
			return;
		}

		$args = array(
			'public'                => false,
			'show_ui'               => true,
			'hierarchical'          => true,
			'show_in_menu'          => true,
			'show_in_nav_menus'     => false,
			'show_tagcloud'         => false,
			'show_admin_column'     => true,
			'capabilities'          => array(
				'manage_terms' => 'upload_files',
				'edit_terms'   => 'upload_files',
				'delete_terms' => 'upload_files',
				'assign_terms' => 'upload_files',
			),
			'rewrite'               => false,
			'update_count_callback' => '_update_generic_term_count',
		);

		$args['object_type'] = array( 'attachment' );

		$this->register( $taxonomy_slug, $args );
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.