Function: get_attachment_taxonomies

get_attachment_taxonomies( integer | array | object $attachment, string $output )

Retrieves taxonomies attached to given the attachment.

Shortcut: gat

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

Parameters

Name Type(s) Default Value Description
$attachment integer | array | object

Attachment ID, data array, or data object.

$output string 'names'

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

Returns

array

Empty array on failure. List of taxonomies on success.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.