Last active
July 15, 2019 19:50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! class_exists( 'AcfFieldMultipleCategories' ) && class_exists( 'acf_field' ) ) { | |
class AcfFieldMultipleCategories extends acf_field { | |
/** | |
* This function will setup the field type data. | |
* | |
* @type function | |
* @date 5/03/2014 | |
* @since 5.0.0 | |
*/ | |
function __construct() { | |
// Vars. | |
$this->name = 'multiple_taxonomies'; | |
$this->label = __( 'Taxonomies','acf' ); | |
$this->category = 'relational'; | |
$this->defaults = array( | |
'taxonomies' => array( 'category' ), | |
'field_type' => 'select', | |
'multiple' => 0, | |
'allow_null' => 0, | |
'return_format' => 'id', | |
'add_term' => 0, | |
'load_terms' => 0, | |
'save_terms' => 0, | |
); | |
// Extra. | |
add_action( 'wp_ajax_acf/fields/taxonomies/query', array( $this, 'ajax_query' ) ); | |
add_action( 'wp_ajax_nopriv_acf/fields/taxonomies/query', array( $this, 'ajax_query' ) ); | |
// Do not delete! | |
parent::__construct(); | |
} | |
/** | |
* Over 500 lines - almost every method copied from acf/includes/fields/class-acf-field-taxonomy.php | |
* Some were tweaked where neccessary to load terms from multiple taxonomies. | |
*/ | |
} | |
new AcfFieldMultipleCategories(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment