Change WordPress user roles and capabilities Forums How to or FAQ using the ure_restrict_edit_post_type filter with custom taxonomy Reply To: using the ure_restrict_edit_post_type filter with custom taxonomy

#4387
Vladimir
Keymaster

‘ure_restrict_edit_post_type’ filter influences to the whole post type (restrict it or do not restrict), not on the current post only. So condition


has_term( 'finance-resources', 'department' )

is not applicable here.

What if to use another blocking model, that is ‘Block’ instead of ‘Allow’. Then URE will hide blocked terms, but any other will still be available.
For example you have categories: 1, 3, 8, 9, 15 and a lot of terms from other taxonomies. You wish to allow to edit just category 3 from the “Categories” taxonomy. Then select “Block” and input into categories ID list field: 1, 8, 9, 15. It should give you a need effect.

I will add a custom filter for terms ID list into the next version. So it will be possible to set the list of prohibited posts by program not manually, which will provide a possibility of a more universal solution.

Manage restrictions directly for the different taxonomies available for the same post type seems a complex task, due to data structure used by WordPress. I suppose also that this feature is not in a high-demand category.

There is a ‘ure_edit_posts_access_id_list’ custom filter which allows to set posts ID list to allow or block for editing.
So you can scan posts list for current user role and built a posts-list by your own checking any terms and taxonomies for the single post from a list of available posts.

It’s possible to set a restriction type via custom filter too. For example:


add_filter('ure_edit_posts_access_restriction_type', 'ure_edit_posts_access_set_restriction_type');

function ure_edit_posts_access_set_restriction_type($restriction_type) {
 
    $restriction_type = 2; // Block 
    
    return $restriction_type;
}