validate_page() ) { return; } // vars $screen = get_current_screen(); $taxonomy = $screen->taxonomy; // load acf scripts acf_enqueue_scripts(); // actions add_action('admin_footer', array($this, 'admin_footer'), 10, 1); add_action("{$taxonomy}_add_form_fields", array($this, 'add_term'), 10, 1); add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 10, 2); } /* * add_term * * description * * @type function * @date 8/10/13 * @since 5.0.0 * * @param $post_id (int) * @return $post_id (int) */ function add_term( $taxonomy ) { // vars $post_id = acf_get_term_post_id( $taxonomy, 0 ); // update vars $this->form = '#addtag'; // get field groups $field_groups = acf_get_field_groups(array( 'taxonomy' => $taxonomy )); // render if( !empty($field_groups) ) { // data acf_form_data(array( 'post_id' => $post_id, 'nonce' => 'taxonomy', )); // loop foreach( $field_groups as $field_group ) { $fields = acf_get_fields( $field_group ); acf_render_fields( $post_id, $fields, 'div', 'field' ); } } } /* * edit_term * * description * * @type function * @date 8/10/13 * @since 5.0.0 * * @param $post_id (int) * @return $post_id (int) */ function edit_term( $term, $taxonomy ) { // vars $post_id = acf_get_term_post_id( $term->taxonomy, $term->term_id ); // update vars $this->form = '#edittag'; // get field groups $field_groups = acf_get_field_groups(array( 'taxonomy' => $taxonomy )); // render if( !empty($field_groups) ) { acf_form_data(array( 'post_id' => $post_id, 'nonce' => 'taxonomy' )); foreach( $field_groups as $field_group ) { $fields = acf_get_fields( $field_group ); ?>