WPDev.one
Core Function
View Source on Trac ↗

get_the_terms()

get_the_terms( mixed $post, mixed $taxonomy )

Retrieves the terms of the taxonomy that are attached to the post.

Parameters 2 required

Name / Type Description
(int

| WP_Post) $post Post ID or object.

Required
$taxonomy
string

Taxonomy name.

Required

Return Value

((WP_Term[])
(WP_Term[] | false | WP_Error) Array of WP_Term objects on success, false if there are no terms or the post does not exist, WP_Error on failure.

Function Information

Since Version
2.5.0
Source File
wp-includes/category-template.php
Advertisement