'string', 'single' => true, 'show_in_rest' => true, 'sanitize_callback' => 'sanitize_hex_color', 'auth_callback' => static function () { return current_user_can( 'manage_categories' ); }, ) ); foreach ( get_taxonomies( array( 'public' => true, 'show_ui' => true ) ) as $taxonomy ) { if ( 'post_format' === $taxonomy ) { continue; } add_action( "{$taxonomy}_add_form_fields", array( $this, 'add_field' ) ); add_action( "{$taxonomy}_edit_form_fields", array( $this, 'edit_field' ) ); add_action( "created_{$taxonomy}", array( $this, 'save' ) ); add_action( "edited_{$taxonomy}", array( $this, 'save' ) ); } } /** * Colour picker on the term screens. * * @param string $hook Admin page. */ public function enqueue( $hook ) { if ( 'edit-tags.php' !== $hook && 'term.php' !== $hook ) { return; } wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' ); wp_add_inline_script( 'wp-color-picker', 'jQuery(function($){$(".gutslider-term-color").wpColorPicker();});' ); } /** * Field on "Add new". */ public function add_field() { ?>

term_id, self::META_KEY, true ); ?>