Tribe__Events__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.


Parameters

$post_status

(string) (Required)

$post_type

(string) (Required)


Top ↑

Return

(string)


Top ↑

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';
	}