CF7 protects admin menu with these meta capabilities:
Contact wpcf7_read_contact_forms
Contact Forms wpcf7_read_contact_forms
Add New wpcf7_edit_contact_forms
Integration wpcf7_manage_integration
and defines its custom post type ‘wpcf7_contact_form’ with the similar list of user capabilities:
'capabilities' => array(
'edit_post' => 'wpcf7_edit_contact_form',
'read_post' => 'wpcf7_read_contact_form',
'delete_post' => 'wpcf7_delete_contact_form',
'edit_posts' => 'wpcf7_edit_contact_forms',
'edit_others_posts' => 'wpcf7_edit_contact_forms',
'publish_posts' => 'wpcf7_edit_contact_forms',
'read_private_posts' => 'wpcf7_edit_contact_forms',
)
You don’t see these capabilities at User Role Editor as they are not exist and not added automatically. CF7 maps them to the existing user capabilities this way:
add_filter( 'map_meta_cap', 'wpcf7_map_meta_cap', 10, 4 );
function wpcf7_map_meta_cap( $caps, $cap, $user_id, $args ) {
$meta_caps = array(
'wpcf7_edit_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
'wpcf7_edit_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
'wpcf7_read_contact_form' => WPCF7_ADMIN_READ_CAPABILITY,
'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY,
'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
'wpcf7_delete_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
'wpcf7_manage_integration' => 'manage_options',
'wpcf7_submit' => 'read',
);
$meta_caps = apply_filters( 'wpcf7_map_meta_cap', $meta_caps );
$caps = array_diff( $caps, array_keys( $meta_caps ) );
if ( isset( $meta_caps[$cap] ) ) {
$caps[] = $meta_caps[$cap];
}
return $caps;
}
Constants definition contains the answer why you can not use CF7 and posts/pages editing separately:
define( 'WPCF7_ADMIN_READ_CAPABILITY', 'edit_posts' );
define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'publish_pages' );
But you can redefine CF7 meta caps using CF7 own filter ‘wpcf7_map_meta_cap’ (applied at the wpcf7_map_meta_cap() showed above) and solve your task.