Here you go (untested, but you should get the idea):
function check_allowed( $post_id ) {
$current_user = wp_get_current_user();
$q = new WP_Query(array('post_type'=>'limited','post_author'=>$current_user->ID));
if($q->found_posts >=10) {
return false;
}
}
add_action( 'publish_post', 'check_allowed' );
Btw: You probably do not want to limit admins in the number of posts they may publish, use editors or a custom role for this purpose.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…