ACF_Rest_Request::get_post_type_by_rest_base()privateACF 1.0

Find the REST enabled post type object that matches the given REST base.

Метод класса: ACF_Rest_Request{}

Хуков нет.

Возвращает

WP_Post_Type|null.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_post_type_by_rest_base( $rest_base );
$rest_base(строка) (обязательный)
-

Код ACF_Rest_Request::get_post_type_by_rest_base() ACF 6.0.4

private function get_post_type_by_rest_base( $rest_base ) {
	$types = get_post_types( array( 'show_in_rest' => true ), 'objects' );

	foreach ( $types as $type ) {
		if ( acf_get_object_type_rest_base( $type ) === $rest_base ) {
			return $type;
		}
	}

	return null;
}