acf_form_taxonomy::edit_term
edit_term
description
Method of the class: acf_form_taxonomy{}
No Hooks.
Returns
$post_id. (int)
Usage
$acf_form_taxonomy = new acf_form_taxonomy(); $acf_form_taxonomy->edit_term( $term, $taxonomy );
- $term(required)
- .
- $taxonomy(required)
- .
Changelog
| Since 5.0.0 | Introduced. |
acf_form_taxonomy::edit_term() acf form taxonomy::edit term code 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>';
}
}
}