# current_user_can()

URL: https://chugunov.pro/api-wordpress/functions/current_user_can/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 2.0.0.

## Сигнатура

```php
current_user_can( string $capability, mixed $args ): bool
```

## Описание

This function also accepts an ID of an object to check against if the capability is a meta capability. Meta capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`.

Example usage:

```
current_user_can( 'edit_posts' );
current_user_can( 'edit_post', $post->ID );
current_user_can( 'edit_post_meta', $post->ID, $meta_key );
```

While checking against particular roles in place of a capability is supported in part, this practice is discouraged as it may produce unreliable results.

Note: Will always return true if the current user is a super admin, unless specifically denied.[See also](#see-also)
- [WP_User::has_cap()](https://developer.wordpress.org/reference/classes/WP_User/has_cap/)

- [map_meta_cap()](https://developer.wordpress.org/reference/functions/map_meta_cap/)

## Параметры

- `$capability` `string` — обязательный. Имя права доступа.
- `$args` `mixed` — необязательный. Необязательные дополнительные параметры, обычно начинающиеся с ID объекта.

## Возвращаемое значение

`bool` — $capability $object_id

## Исходный код

Файл: `wp-includes/capabilities.php:913`

```php
function current_user_can( $capability, ...$args ) {
	return user_can( wp_get_current_user(), $capability, ...$args );
}
```

## История изменений

- 5.8.0 — Converted to wrapper for the user_can() function.
- 5.3.0 — Formalized the existing and already documented ...$args parameter by adding it to the function signature.
- 2.0.0 — Introduced.

## Связанные

Использует: [`user_can`](https://chugunov.pro/api-wordpress/functions/user_can/), [`wp_get_current_user`](https://chugunov.pro/api-wordpress/functions/wp_get_current_user/).
Используется в: `WP_REST_Icons_Controller::get_items_permissions_check`, `WP_HTTP_Polling_Sync_Server::check_permissions`, `WP_HTTP_Polling_Sync_Server::can_user_sync_entity_type`, [`wp_enqueue_command_palette_assets`](https://chugunov.pro/api-wordpress/functions/wp_enqueue_command_palette_assets/), [`wp_create_initial_comment_meta`](https://chugunov.pro/api-wordpress/functions/wp_create_initial_comment_meta/), [`_block_bindings_post_data_get_value`](https://chugunov.pro/api-wordpress/functions/_block_bindings_post_data_get_value/), [`_block_bindings_term_data_get_value`](https://chugunov.pro/api-wordpress/functions/_block_bindings_term_data_get_value/), `WP_REST_Abilities_V1_Categories_Controller::get_items_permissions_check`, `WP_REST_Abilities_V1_Categories_Controller::get_item_permissions_check`, `WP_REST_Abilities_V1_List_Controller::get_items_permissions_check`, `WP_REST_Abilities_V1_List_Controller::get_item_permissions_check`, [`wp_register_core_abilities`](https://chugunov.pro/api-wordpress/functions/wp_register_core_abilities/), [`wp_initialize_site_preview_hooks`](https://chugunov.pro/api-wordpress/functions/wp_initialize_site_preview_hooks/), `WP_REST_Menu_Locations_Controller::check_has_read_only_access`, [`current_user_can_for_site`](https://chugunov.pro/api-wordpress/functions/current_user_can_for_site/), [`_block_bindings_post_meta_get_value`](https://chugunov.pro/api-wordpress/functions/_block_bindings_post_meta_get_value/), `WP_Plugin_Dependencies::check_plugin_dependencies_during_ajax`, `WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies`, `WP_REST_Font_Faces_Controller::get_item_permissions_check`, `WP_REST_Font_Faces_Controller::get_items_permissions_check`, `WP_REST_Font_Families_Controller::get_item_permissions_check`, `WP_REST_Font_Families_Controller::get_items_permissions_check`, `WP_REST_Font_Collections_Controller::get_items_permissions_check`, [`wp_ajax_activate_plugin`](https://chugunov.pro/api-wordpress/functions/wp_ajax_activate_plugin/), [`wp_get_plugin_action_button`](https://chugunov.pro/api-wordpress/functions/wp_get_plugin_action_button/), `WP_REST_Template_Revisions_Controller::delete_item_permissions_check`, [`_wp_footnotes_kses_init`](https://chugunov.pro/api-wordpress/functions/_wp_footnotes_kses_init/), `WP_REST_Navigation_Fallback_Controller::get_item_permissions_check`, [`wp_get_theme_preview_path`](https://chugunov.pro/api-wordpress/functions/wp_get_theme_preview_path/), [`wp_attach_theme_preview_middleware`](https://chugunov.pro/api-wordpress/functions/wp_attach_theme_preview_middleware/), `WP_REST_Terms_Controller::check_read_terms_permission_for_post`, [`wp_refresh_metabox_loader_nonces`](https://chugunov.pro/api-wordpress/functions/wp_refresh_metabox_loader_nonces/), `WP_REST_Block_Patterns_Controller::get_items_permissions_check`, `WP_REST_Block_Pattern_Categories_Controller::get_items_permissions_check`, `WP_REST_Global_Styles_Controller::get_theme_item_permissions_check`, `WP_REST_Menu_Items_Controller::check_has_read_only_access`, `WP_REST_Global_Styles_Controller::check_read_permission`, `WP_REST_Global_Styles_Controller::get_available_actions`, `WP_REST_URL_Details_Controller::permissions_check`, `WP_REST_Menus_Controller::check_has_read_only_access`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/current_user_can/
