WordPressで作り込んだデザインなどを実装する場合、
複数カテゴリーを選択できるより、ひとつの記事にひとつのカテゴリーとしておいたほうが
便利な場合が多くあります。
使用しているテンプレートのfunctions.php
に以下のコードを記述します。
//カテゴリーをラジオボタン化
function change_category_to_radio() {
?>
<script>
jQuery(function($) {
// ラジオボタン化
$('#categorychecklist input[type=checkbox]').each(function() {
$(this).replaceWith($(this).clone().attr('type', 'radio'));
});
// 「新規カテゴリーを追加」を非表示
$('#category-adder').hide();
// 「よく使うもの」を非表示
$('#category-tabs').hide();
});
</script>
<?php
}
add_action( 'admin_head-post-new.php', 'change_category_to_radio' );
add_action( 'admin_head-post.php', 'change_category_to_radio' );