function post_published_limit() {
$max_posts = 3; // change this or set it as an option that you can retrieve.
$author = $post->post_author; // Post author ID.
$count = count_user_posts( $author, \'CUSTOMPOSTTYPE\'); // get author post count
if ( $count > $max_posts ) {
// count too high, let\'s set it to draft.
$post = array(
\'post_status\' => \'draft\'
);
wp_update_post( $post );
}
}
add_action( \'publish_CUSTOMPOSTTYPE\', \'post_published_limit\' );
希望这是你的答案。