acf_get_object_type_rest_base()ACF 1.0

Determine the REST base for a post type or taxonomy object. Note that this is not intended for use with term or post objects but is, instead, to be used with the underlying WP_Post_Type and WP_Taxonomy instances.

Хуков нет.

Возвращает

Строку|null.

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

acf_get_object_type_rest_base( $type_object );
$type_object(WP_Post_Type|WP_Taxonomy) (обязательный)
-

Код acf_get_object_type_rest_base() ACF 6.0.4

function acf_get_object_type_rest_base( $type_object ) {
	if ( $type_object instanceof WP_Post_Type || $type_object instanceof WP_Taxonomy ) {
		return ! empty( $type_object->rest_base ) ? $type_object->rest_base : $type_object->name;
	}

	return null;
}