Tribe__Tickets__REST__V1__Endpoints__Base::scale_back_post_status( string $post_status, string $post_type )
Falls back on an allowed post status in respect to the user user capabilities of publishing.
Contents
Parameters
- $post_status
-
(string) (Required)
- $post_type
-
(string) (Required)
Return
(string)
Source
File: src/Tribe/REST/V1/Endpoints/Base.php
public function scale_back_post_status( $post_status, $post_type ) {
$post_type_object = get_post_type_object( $post_type );
if ( current_user_can( $post_type_object->cap->publish_posts ) ) {
return ! empty( $post_status ) ? $post_status : 'publish';
}
if ( in_array( $post_status, array( 'publish', 'future' ) ) ) {
return 'pending';
}
return ! empty( $post_status ) ? $post_status : 'draft';
}
Changelog
| Version | Description |
|---|---|
| 4.7.5 | Introduced. |