function limit_category_select() {
?>
<script type="text/javascript">
jQuery(function($) {
// 投稿画面のタクソノミー選択数を制限
// ---------------------------------------------
var $tax_checklist = $('#recommended_point_taxchecklist input[type=checkbox]');
$tax_checklist.click(function(){
var $tax_checklist_count = $("#recommended_point_taxchecklist input[type=checkbox]:checked").length;
var $tax_checklist_notchecked = $tax_checklist.not(':checked')
if ($tax_checklist_count >= 6) {
$tax_checklist_notchecked.attr("disabled", true);
} else {
$tax_checklist_notchecked.attr("disabled", false);
}
});
$('#taxonomy-recommended_point_tax').before('<p style="font-size:12px;">※MAX6つまで選択することが出来ます</p>')
});
</script>
<?php
}
add_action( 'admin_print_footer_scripts', 'limit_category_select' );