'include' ), $taxonomies = array(), $selected = array(), $exclude = array( 'product_visibility', 'product_type' ); function __construct($args) { parent::__construct($args); $this->value = array_filter($this->value, function($taxonomy){ return taxonomy_exists($taxonomy); }); $taxonomies = get_taxonomies(array('_builtin' => false), 'objects', 'and'); foreach ( $taxonomies as $taxonomy ) { if ( !in_array($taxonomy->name, $this->exclude) ) { $label = isset($tax->object_type, $tax->object_type[0]) ? $tax->object_type[0] . ' - ' . $taxonomy->labels->name : $taxonomy->labels->name; if ( !in_array($taxonomy->name, $this->value) ) { $this->taxonomies[$taxonomy->name] = $label; } if ( in_array($taxonomy->name, $this->value) ) { $this->selected[$taxonomy->name] = $label; } } } } public static function value( $value, $default_value = null ) { return array_filter(explode('|', $value)); } protected static function outputValue( $value ) { // No need to decode return implode('|', $value); } function render() { ?>