ACF_Taxonomy::register_taxonomiespublicACF 6.1

Register activated taxonomies with WordPress

Метод класса: ACF_Taxonomy{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ACF_Taxonomy = new ACF_Taxonomy();
$ACF_Taxonomy->register_taxonomies();

Список изменений

С версии 6.1 Введена.

Код ACF_Taxonomy::register_taxonomies() ACF 6.4.2

public function register_taxonomies() {
	$taxonomies = $this->get_posts( array( 'active' => true ) );
	foreach ( $taxonomies as $taxonomy ) {
		$args = $this->get_taxonomy_args( $taxonomy );
		if ( ! taxonomy_exists( $taxonomy['taxonomy'] ) ) {
			register_taxonomy( $taxonomy['taxonomy'], (array) $taxonomy['object_type'], $args );
		} else {
				// Flag on the store we bailed on registering this as it already exists.
				$store                         = acf_get_store( $this->store );
				$store_value                   = $store->get( $taxonomy['key'] );
				$store_value['not_registered'] = true;
				$store->set( $taxonomy['key'], $store_value );
		}
	}
}