Change User Capabilities based on an option

I am working on a trial system where a user can download our theme but is restricted to X pages and posts until they register the theme. Our custom post types were easy to add ‘create_posts’=> false to the capabilities but I cant seem to figure out how to do this for Pages & Posts.

I have tried the following but it does not make any difference

add_filter( ‘user_has_cap’, ‘override_caps’ );
function override_caps($allcaps){
$allcaps[‘create_pages’]=0;
return $allcaps;
}

Read more here:: Change User Capabilities based on an option

Leave a Reply

Your email address will not be published. Required fields are marked *