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 = "{$taxonomy}_0"; $args = array( 'taxonomy' => $taxonomy ); // update vars $this->form = '#addtag'; // get field groups $field_groups = acf_get_field_groups( $args ); // 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 ); 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 = "{$taxonomy}_{$term->term_id}"; $args = array( 'taxonomy' => $taxonomy ); // update vars $this->form = '#edittag'; // get field groups $field_groups = acf_get_field_groups( $args ); // 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 ); ?>

query($wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s", '%' . $taxonomy . '_' . $term . '%' )); } } new acf_form_taxonomy(); endif; ?>