automatewoo/includes/Fields/Taxonomy.php
fei-source 47d3c9a8b6 Update to v6.2.2
Source: GrootMade/Festinger Vault
2026-03-15 08:31:15 +08:00

56 lines
889 B
PHP

<?php
// phpcs:ignoreFile
namespace AutomateWoo\Fields;
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* @class Taxonomy
*/
class Taxonomy extends Select {
protected $name = 'taxonomy';
function __construct( $show_placeholder = true ) {
parent::__construct( $show_placeholder );
$this->set_title( __( 'Taxonomy', 'automatewoo' ) );
}
/**
* @return array
*/
function get_options() {
$taxonomies = get_taxonomies( [], false );
$exclude = [
'action-group',
'nav_menu',
'post_format',
'link_category',
'category',
'post_tag',
'product_type',
'product_shipping_class',
'product_visibility',
];
$options = [];
foreach( $taxonomies as $tax_slug => $taxonomy ) {
if ( in_array($tax_slug, $exclude) )
continue;
$options[$tax_slug] = $taxonomy->labels->name;
}
$this->set_options( $options );
return $this->options;
}
}