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.