get_attachment_taxonomies

SummerySummery

Retrieves taxonomies attached to given the attachment.

Syntax

get_attachment_taxonomies( int|array|object $attachment, string $output = 'names' )

ParametersParameters

$attachment

(int|array|object) (Required) Attachment ID, data array, or data object.

$output

(string) (Optional) Output type. 'names' to return an array of taxonomy names, or 'objects' to return an array of taxonomy objects. Default is 'names'.

Default value: 'names'

ReturnReturn

(string[]|WP_Taxonomy[]) List of taxonomies or taxonomy names. Empty array on failure.

SourceSource

File: wp-includes/media.php


			

ChangelogChangelog

Changelog
Version Description
4.7.0 Introduced the $output parameter.
2.5.0 Introduced.
Scroll to Top