acf_current_user_can_edit_post()ACF 6.3.4

Wrapper function for current_user_can( edit_post, $post_id ).

Хуки из функции

Возвращает

true|false.

Использование

acf_current_user_can_edit_post( $post_id ): bool;
$post_id(int) (обязательный)
The post ID to check.

Список изменений

С версии 6.3.4 Введена.

Код acf_current_user_can_edit_post() ACF 6.4.2

function acf_current_user_can_edit_post( int $post_id ): bool {
	/**
	 * The `edit_post` capability is a meta capability, which
	 * gets converted to the correct post type object `edit_post`
	 * equivalent.
	 *
	 * If the post type does not have `map_meta_cap` enabled and the user is
	 * not manually mapping the `edit_post` capability, this will fail
	 * unless the role has the `edit_post` capability added to a user/role.
	 *
	 * However, more (core) stuff will likely break in this scenario.
	 */
	$user_can_edit = current_user_can( 'edit_post', $post_id );

	return (bool) apply_filters( 'acf/current_user_can_edit_post', $user_can_edit, $post_id );
}