我对自定义帖子类型进行了限制;vereine;。这是可行的,但管理员通知是自定义帖子已发布(而不是草稿)。如何添加消息?以下是限制的代码
function post_published_limit() {
$max_posts = 1; // anzahl der maximalen Vereinseintragungen
$author = $post->vereinsmanager; // nur fuer vereinsmanager limitierung
$count = count_user_posts( $author, \'vereine\');
if ( $count > $max_posts ) {
// wenn mehr als 1, dann auf Entwurf setzen und Notiz für vereinsmanager ausgeben
$post = array(\'post_status\' => \'draft\');
wp_update_post( $post );
}
}
add_action( \'publish_vereine\', \'post_published_limit\' );
谢谢你的帮助,问候