admin管理员组文章数量:1026134
This is regardging to On multisite installation and setting limit to content creation by sub-site admins.
I want to set a limit for posts,pages or any custom post types for any sub-site admins. So that they could just create certain number of pages and not more than that. I don't know what filter could help to set limit in functions.php.
Could any one help me with that? So that I could achieve it?
Thanks!
This is regardging to On multisite installation and setting limit to content creation by sub-site admins.
I want to set a limit for posts,pages or any custom post types for any sub-site admins. So that they could just create certain number of pages and not more than that. I don't know what filter could help to set limit in functions.php.
Could any one help me with that? So that I could achieve it?
Thanks!
Share Improve this question asked May 20, 2013 at 13:11 NetizenNetizen 1791 gold badge4 silver badges18 bronze badges2 Answers
Reset to default 1Important Link:
- Posts Creation Limits
Dig into this plugin you easily get the code for limit posts/pages.
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' );
Hope this is your answer.
This is regardging to On multisite installation and setting limit to content creation by sub-site admins.
I want to set a limit for posts,pages or any custom post types for any sub-site admins. So that they could just create certain number of pages and not more than that. I don't know what filter could help to set limit in functions.php.
Could any one help me with that? So that I could achieve it?
Thanks!
This is regardging to On multisite installation and setting limit to content creation by sub-site admins.
I want to set a limit for posts,pages or any custom post types for any sub-site admins. So that they could just create certain number of pages and not more than that. I don't know what filter could help to set limit in functions.php.
Could any one help me with that? So that I could achieve it?
Thanks!
Share Improve this question asked May 20, 2013 at 13:11 NetizenNetizen 1791 gold badge4 silver badges18 bronze badges2 Answers
Reset to default 1Important Link:
- Posts Creation Limits
Dig into this plugin you easily get the code for limit posts/pages.
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' );
Hope this is your answer.
本文标签: Setting limit to posts or page creation
版权声明:本文标题:Setting limit to posts or page creation 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745630492a2160134.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论