By GUI it's not possible to assign Custom Post Groups to single Posts based on conditions.
Example:
Access Post Group A should be only assigned to Posts with Term "ABC" assigned, but never to posts with term "DEF" assigned.
For those, Access Post Group B should be used.
Supporter Beda mentioned this can be done with custom code.
I am here to get informations about what I need to observe when writing this code, where Toolset stores the information, etc, so I can craft a Custom Code, that automatically sets the correct Access Post Group to the posts depending on a condition (which can be Terms, in the example, or whatever else)
Hi, essentially you'll be updating a custom field value in the database. The field slug is _wpcf_access_group and the value has a unique hash like this: wpcf-custom-group-1584797355f2d242ba5c8c879e748829. In order to determine the correct unique hash for each post group, you'll need to check in the database. Assign each post group to some post, then you can find the _wpcf_access_group entry for each of those posts in the postmeta table. Copy the corresponding meta_values for each post group and paste them in your custom code.
Here's an example showing how to modify a post group for some post:
update_post_meta($post_id,'_wpcf_access_group','wpcf-custom-group-1584797355f2d242ba5c8c879e748829');
Use the save_post action with a minimum priority of 15 to hook into the post save process.
add_action( 'save_post', 'automate_group', 100, 3 );
function automate_group( $post_id, $post, $update ) {
// add your code here to test the post's terms or custom field values
// and apply the correct post group
}
https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
https://codex.wordpress.org/Function_Reference/update_post_meta