Tribe__Editor__Meta::auth_callback( bool $allowed, string $meta_key, int $post_id, int $user_id, string $cap, array $caps )
Verify if the current user can edit or not this Post
Contents
Parameters
- $allowed
-
(bool) (Required) Whether the user can add the post meta. Default false.
- $meta_key
-
(string) (Required) The meta key.
- $post_id
-
(int) (Required) Post ID.
- $user_id
-
(int) (Required) User ID.
- $cap
-
(string) (Required) Capability name.
- $caps
-
(array) (Required) User capabilities.
Return
(boolean)
Source
File: src/Tribe/Editor/Meta.php
public function auth_callback( $allowed, $meta_key, $post_id, $user_id, $cap, $caps ) {
$post = get_post( $post_id );
$post_type_obj = get_post_type_object( $post->post_type );
$current_user_can = current_user_can( $post_type_obj->cap->edit_post, $post_id );
return $current_user_can;
}
Changelog
| Version | Description |
|---|---|
| 4.8 | Introduced. |