acf_form_taxonomy::edit_term()publicACF 5.0.0

edit_term

description

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

Хуков нет.

Возвращает

$post_id. (int)

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

$acf_form_taxonomy = new acf_form_taxonomy();
$acf_form_taxonomy->edit_term( $term, $taxonomy );
$term (обязательный)
-
$taxonomy (обязательный)
-

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

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

Код acf_form_taxonomy::edit_term() ACF 6.0.4

function edit_term( $term, $taxonomy ) {

	// vars
	$post_id = 'term_' . $term->term_id;

	// update vars
	$this->view = 'edit';

	// get field groups
	$field_groups = acf_get_field_groups(
		array(
			'taxonomy' => $taxonomy,
		)
	);

	// render
	if ( ! empty( $field_groups ) ) {

		acf_form_data(
			array(
				'screen'  => 'taxonomy',
				'post_id' => $post_id,
			)
		);

		foreach ( $field_groups as $field_group ) {

				// title
			if ( $field_group['style'] == 'default' ) {
				echo '<h2>' . $field_group['title'] . '</h2>';
			}

				// fields
				echo '<table class="form-table">';
			$fields = acf_get_fields( $field_group );
			acf_render_fields( $fields, $post_id, 'tr', 'field' );
				echo '</table>';

		}
	}

}