Access API Filters
Filter to check permission for specific post.
bool $has_permission
string|int|WP_Post|null $post_source
Valid post ID or a post object. Defaults to the current post.
string $permission_type
Type of the permission to check. Possible values: read, edit. Optional. Defaults to read.
int|WP_User $user
User to check permission for. Optional. Defaults to current user.
string $language_code
The language code of the post, i.e. en. Optional. Defaults to default language.
bool
More Usage examples
$has_permission = current_user_can('edit_posts'); $has_permissions = apply_filters('toolset_access_api_get_post_permissions', $has_permission, 1, 'edit', $current_user, 'en');
Filter to check permission for specific post type.
bool $has_permission
string $post_type_slug
The slug of the post type.
string $permission_type
Type of the permission to check. Possible values: publish, edit_own, edit_any, delete_own, delete_any, read. Optional. Defaults to read.
int|WP_User $user
User to check permission for. Optional. Defaults to current user.
string $language_code
The language code of the post, i.e. en. Optional. Defaults to default language.
bool
More Usage examples
$has_permission = current_user_can('edit_posts'); $has_permissions = apply_filters('toolset_access_api_get_post_type_permissions', $has_permission, 'page', 'edit_own', $current_user, 'en');
Filter to check permission for specific taxonomy.
bool $has_permission
string $taxonomy_slug
The slug of the taxonomy.
string $permission_type
Type of the permission to check. Possible values: assign_terms, delete_terms, edit_terms, manage_terms. Optional. Defaults to manage_terms.
int|WP_User $user
User to check permission for. Optional. Defaults to current user.
bool
More Usage examples
$has_permission = current_user_can('manage_categories'); $has_permissions = apply_filters('toolset_access_api_get_taxonomy_permissions', $has_permission, 'category', 'manage_terms', $current_user);
Use this filter to define for which specific user roles should the Access button be hidden.
array $roles
This filter takes only one argument and it must return an array. The returned array contains the roles for which Access editor button will be disabled. For example, returning array( 'author', 'subscriber')
means that the Access editor button will not be available for users with an author or subscriber role.
array
More Usage examples
add_filter('toolset_editor_access_button_disable_by_role','wpcf_hide_access_button'); function wpcf_hide_access_button( $roles=array() ){ return array('author', 'subscriber'); }