function.phpに下記を記述

add_action( 'create_blog_cat', 'post_taxonomy_auto_slug', 10 );
function post_taxonomy_auto_slug( $term_id ) {
	$tax = str_replace( 'create_', '', current_filter() );
	$term = get_term( $term_id, $tax );
	if ( preg_match( '/(%[0-9a-f]{2})+/', $term->slug ) ) {
		$args = array(
			'slug' => $term->taxonomy . '-' . $term->term_id
		);
		wp_update_term( $term_id, $tax, $args );
	}
}

latest post

0