acf_field_taxonomy::initialize
__construct
This function will setup the field type data
Method of the class: acf_field_taxonomy{}
No Hooks.
Returns
null. Nothing (null).
Usage
$acf_field_taxonomy = new acf_field_taxonomy(); $acf_field_taxonomy->initialize();
Changelog
| Since 5.0.0 | Introduced. |
acf_field_taxonomy::initialize() acf field taxonomy::initialize code ACF 6.0.4
function initialize() {
// vars
$this->name = 'taxonomy';
$this->label = __( 'Taxonomy', 'acf' );
$this->category = 'relational';
$this->defaults = array(
'taxonomy' => 'category',
'field_type' => 'checkbox',
'multiple' => 0,
'allow_null' => 0,
'return_format' => 'id',
'add_term' => 1, // 5.2.3
'load_terms' => 0, // 5.2.7
'save_terms' => 0, // 5.2.7
);
// Register filter variations.
acf_add_filter_variations( 'acf/fields/taxonomy/query', array( 'name', 'key' ), 1 );
acf_add_filter_variations( 'acf/fields/taxonomy/result', array( 'name', 'key' ), 2 );
// ajax
add_action( 'wp_ajax_acf/fields/taxonomy/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_nopriv_acf/fields/taxonomy/query', array( $this, 'ajax_query' ) );
add_action( 'wp_ajax_acf/fields/taxonomy/add_term', array( $this, 'ajax_add_term' ) );
// actions
add_action( 'acf/save_post', array( $this, 'save_post' ), 15, 1 );
}