Title: get_the_terms
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( ‘get_the_terms’, WP_Term[]|WP_Error $terms, int $post_id, string $taxonomy )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#wp--skip-link--target)

Filters the list of terms attached to the given post.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#parameters)󠁿

 `$terms`[WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)[]
|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)

Array of attached terms, or [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
on failure.

`$post_id`int

Post ID.

`$taxonomy`string

Name of the taxonomy.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#source)󠁿

    ```php
    $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/category-template.php#L1314)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/category-template.php#L1314-L1314)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#related)󠁿

| Used by | Description | 
| [get_the_terms()](https://developer.wordpress.org/reference/functions/get_the_terms/)`wp-includes/category-template.php` |

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

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/get_the_terms/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fget_the_terms%2F)
before being able to contribute a note or feedback.