src/class-extended-taxonomy-admin.php
public function meta_boxes( $object_type, $object ) {

		if ( ! is_a( $object, 'WP_Post' ) ) {
			return;
		}

		$post_type = $object_type;
		$post      = $object;
		$taxos     = get_post_taxonomies( $post );

		if ( in_array( $this->taxo->taxonomy, $taxos, true ) ) {

			$tax = get_taxonomy( $this->taxo->taxonomy );

			# Remove default meta box:
			if ( $this->taxo->args['hierarchical'] ) {
				remove_meta_box( "{$this->taxo->taxonomy}div", $post_type, 'side' );
			} else {
				remove_meta_box( "tagsdiv-{$this->taxo->taxonomy}", $post_type, 'side' );
			}

			if ( ! current_user_can( $tax->cap->assign_terms ) ) {
				return;
			}

			if ( $this->args['meta_box'] ) {

				# Set the 'meta_box' argument to the actual meta box callback function name:
				if ( 'simple' === $this->args['meta_box'] ) {
					if ( $this->taxo->args['exclusive'] ) {
						$this->args['meta_box'] = [ $this, 'meta_box_radio' ];
					} else {
						$this->args['meta_box'] = [ $this, 'meta_box_simple' ];
					}
				} elseif ( 'radio' === $this->args['meta_box'] ) {
					$this->taxo->args['exclusive'] = true;
					$this->args['meta_box'] = [ $this, 'meta_box_radio' ];
				} elseif ( 'dropdown' === $this->args['meta_box'] ) {
					$this->taxo->args['exclusive'] = true;
					$this->args['meta_box'] = [ $this, 'meta_box_dropdown' ];
				}

				# Add the meta box, using the plural or singular taxonomy label where relevant:
				if ( $this->taxo->args['exclusive'] ) {
					add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->singular_name, $this->args['meta_box'], $post_type, 'side' );
				} else {
					add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->name, $this->args['meta_box'], $post_type, 'side' );
				}
			} elseif ( false !== $this->args['meta_box'] ) {

				# This must be an 'exclusive' taxonomy. Add the radio meta box:
				add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->singular_name, [ $this, 'meta_box_radio' ], $post_type, 'side' );

			}
		}

	}
public function meta_boxes( $object_type, $object ) {

		if ( ! is_a( $object, 'WP_Post' ) ) {
			return;
		}

		$post_type = $object_type;
		$post      = $object;
		$taxos     = get_post_taxonomies( $post );

		if ( in_array( $this->taxo->taxonomy, $taxos, true ) ) {

			$tax = get_taxonomy( $this->taxo->taxonomy );

			# Remove default meta box:
			if ( $this->taxo->args['hierarchical'] ) {
				remove_meta_box( "{$this->taxo->taxonomy}div", $post_type, 'side' );
			} else {
				remove_meta_box( "tagsdiv-{$this->taxo->taxonomy}", $post_type, 'side' );
			}

			if ( ! current_user_can( $tax->cap->assign_terms ) ) {
				return;
			}

			if ( $this->args['meta_box'] ) {

				# Set the 'meta_box' argument to the actual meta box callback function name:
				if ( 'simple' === $this->args['meta_box'] ) {
					if ( $this->taxo->args['exclusive'] ) {
						$this->args['meta_box'] = [ $this, 'meta_box_radio' ];
					} else {
						$this->args['meta_box'] = [ $this, 'meta_box_simple' ];
					}
				} elseif ( 'radio' === $this->args['meta_box'] ) {
					$this->taxo->args['exclusive'] = true;
					$this->args['meta_box'] = [ $this, 'meta_box_radio' ];
				} elseif ( 'dropdown' === $this->args['meta_box'] ) {
					$this->taxo->args['exclusive'] = true;
					$this->args['meta_box'] = [ $this, 'meta_box_dropdown' ];
				}

				# Add the meta box, using the plural or singular taxonomy label where relevant:
				if ( $this->taxo->args['exclusive'] ) {
					add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->singular_name, $this->args['meta_box'], $post_type, 'side' );
				} else {
					add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->name, $this->args['meta_box'], $post_type, 'side' );
				}
			} elseif ( false !== $this->args['meta_box'] ) {

				# This must be an 'exclusive' taxonomy. Add the radio meta box:
				add_meta_box( "{$this->taxo->taxonomy}div", $tax->labels->singular_name, [ $this, 'meta_box_radio' ], $post_type, 'side' );

			}
		}

	}
public function meta_boxes ( $ object_type , $ object ) { if ( ! is_a ( $ object , 'WP_Post' ) ) { return ; } $ post_type = $ object_type ; $ post = $ object ; $ taxos = get_post_taxonomies ( $ post ) ; if ( in_array ( $ this -> taxo -> taxonomy , $ taxos , true ) ) { $ tax = get_taxonomy ( $ this -> taxo -> taxonomy ) ; # Remove default meta box: if ( $ this -> taxo -> args [ 'hierarchical' ] ) { remove_meta_box ( "{$this->taxo->taxonomy}div" , $ post_type , 'side' ) ; } else { remove_meta_box ( "tagsdiv-{$this->taxo->taxonomy}" , $ post_type , 'side' ) ; } if ( ! current_user_can ( $ tax -> cap -> assign_terms ) ) { return ; } if ( $ this -> args [ 'meta_box' ] ) { # Set the 'meta_box' argument to the actual meta box callback function name: if ( 'simple' === $ this -> args [ 'meta_box' ] ) { if ( $ this -> taxo -> args [ 'exclusive' ] ) { $ this -> args [ 'meta_box' ] = [ $ this , 'meta_box_radio' ] ; } else { $ this -> args [ 'meta_box' ] = [ $ this , 'meta_box_simple' ] ; } } elseif ( 'radio' === $ this -> args [ 'meta_box' ] ) { $ this -> taxo -> args [ 'exclusive' ] = true ; $ this -> args [ 'meta_box' ] = [ $ this , 'meta_box_radio' ] ; } elseif ( 'dropdown' === $ this -> args [ 'meta_box' ] ) { $ this -> taxo -> args [ 'exclusive' ] = true ; $ this -> args [ 'meta_box' ] = [ $ this , 'meta_box_dropdown' ] ; } # Add the meta box, using the plural or singular taxonomy label where relevant: if ( $ this -> taxo -> args [ 'exclusive' ] ) { add_meta_box ( "{$this->taxo->taxonomy}div" , $ tax -> labels -> singular_name , $ this -> args [ 'meta_box' ] , $ post_type , 'side' ) ; } else { add_meta_box ( "{$this->taxo->taxonomy}div" , $ tax -> labels -> name , $ this -> args [ 'meta_box' ] , $ post_type , 'side' ) ; } } elseif ( false !== $ this -> args [ 'meta_box' ] ) { # This must be an 'exclusive' taxonomy. Add the radio meta box: add_meta_box ( "{$this->taxo->taxonomy}div" , $ tax -> labels -> singular_name , [ $ this , 'meta_box_radio' ] , $ post_type , 'side' ) ; } } }
Remove the default meta box from the post editing screen and add our custom meta box.

@param string $object_type The object type (eg. the post type)
@param mixed  $object      The object (eg. a WP_Post object)
@return null
Remove the default meta box from the post editing screen and add our custom meta box .