the_terms

The timeline below displays how wordpress function the_terms has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Displays the terms for a post in a list.
 *
 * @since 2.5.0
 *
 * @param int    $post_id  Post ID.
 * @param string $taxonomy Taxonomy name.
 * @param string $before   Optional. String to use before the terms. Default empty.
 * @param string $sep      Optional. String to use between the terms. Default ', '.
 * @param string $after    Optional. String to use after the terms. Default empty.
 * @return void|false Void on success, false on failure.
 */
function the_terms($post_id, $taxonomy, $before = '', $sep = ', ', $after = '')
{
    $term_list = get_the_term_list($post_id, $taxonomy, $before, $sep, $after);
    if (is_wp_error($term_list)) {
        return false;
    }
    /**
     * Filters the list of terms to display.
     *
     * @since 2.9.0
     *
     * @param string $term_list List of terms to display.
     * @param string $taxonomy  The taxonomy name.
     * @param string $before    String to use before the terms.
     * @param string $sep       String to use between the terms.
     * @param string $after     String to use after the terms.
     */
    echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}

WordPress Version: 5.4

/**
 * Display the terms in a list.
 *
 * @since 2.5.0
 *
 * @param int    $id       Post ID.
 * @param string $taxonomy Taxonomy name.
 * @param string $before   Optional. Before list.
 * @param string $sep      Optional. Separate items using this.
 * @param string $after    Optional. After list.
 * @return void|false Void on success, false on failure.
 */
function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '')
{
    $term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
    if (is_wp_error($term_list)) {
        return false;
    }
    /**
     * Filters the list of terms to display.
     *
     * @since 2.9.0
     *
     * @param string $term_list List of terms to display.
     * @param string $taxonomy  The taxonomy name.
     * @param string $before    String to use before the terms.
     * @param string $sep       String to use between the terms.
     * @param string $after     String to use after the terms.
     */
    echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}

WordPress Version: 5.1

/**
 * Display the terms in a list.
 *
 * @since 2.5.0
 *
 * @param int $id Post ID.
 * @param string $taxonomy Taxonomy name.
 * @param string $before Optional. Before list.
 * @param string $sep Optional. Separate items using this.
 * @param string $after Optional. After list.
 * @return false|void False on WordPress error.
 */
function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '')
{
    $term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
    if (is_wp_error($term_list)) {
        return false;
    }
    /**
     * Filters the list of terms to display.
     *
     * @since 2.9.0
     *
     * @param string $term_list List of terms to display.
     * @param string $taxonomy  The taxonomy name.
     * @param string $before    String to use before the terms.
     * @param string $sep       String to use between the terms.
     * @param string $after     String to use after the terms.
     */
    echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}

WordPress Version: 4.6

/**
 * Display the terms in a list.
 *
 * @since 2.5.0
 *
 * @param int $id Post ID.
 * @param string $taxonomy Taxonomy name.
 * @param string $before Optional. Before list.
 * @param string $sep Optional. Separate items using this.
 * @param string $after Optional. After list.
 * @return false|void False on WordPress error.
 */
function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '')
{
    $term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
    if (is_wp_error($term_list)) {
        return false;
    }
    /**
     * Filters the list of terms to display.
     *
     * @since 2.9.0
     *
     * @param array  $term_list List of terms to display.
     * @param string $taxonomy  The taxonomy name.
     * @param string $before    String to use before the terms.
     * @param string $sep       String to use between the terms.
     * @param string $after     String to use after the terms.
     */
    echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}

WordPress Version: 4.3

/**
 * Display the terms in a list.
 *
 * @since 2.5.0
 *
 * @param int $id Post ID.
 * @param string $taxonomy Taxonomy name.
 * @param string $before Optional. Before list.
 * @param string $sep Optional. Separate items using this.
 * @param string $after Optional. After list.
 * @return false|void False on WordPress error.
 */
function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '')
{
    $term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
    if (is_wp_error($term_list)) {
        return false;
    }
    /**
     * Filter the list of terms to display.
     *
     * @since 2.9.0
     *
     * @param array  $term_list List of terms to display.
     * @param string $taxonomy  The taxonomy name.
     * @param string $before    String to use before the terms.
     * @param string $sep       String to use between the terms.
     * @param string $after     String to use after the terms.
     */
    echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}

WordPress Version: 4.1

/**
 * Display the terms in a list.
 *
 * @since 2.5.0
 *
 * @param int $id Post ID.
 * @param string $taxonomy Taxonomy name.
 * @param string $before Optional. Before list.
 * @param string $sep Optional. Separate items using this.
 * @param string $after Optional. After list.
 * @return false|null False on WordPress error. Returns null when displaying.
 */
function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '')
{
    $term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
    if (is_wp_error($term_list)) {
        return false;
    }
    /**
     * Filter the list of terms to display.
     *
     * @since 2.9.0
     *
     * @param array  $term_list List of terms to display.
     * @param string $taxonomy  The taxonomy name.
     * @param string $before    String to use before the terms.
     * @param string $sep       String to use between the terms.
     * @param string $after     String to use after the terms.
     */
    echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}

WordPress Version: 3.9

/**
 * Display the terms in a list.
 *
 * @since 2.5.0
 *
 * @param int $id Post ID.
 * @param string $taxonomy Taxonomy name.
 * @param string $before Optional. Before list.
 * @param string $sep Optional. Separate items using this.
 * @param string $after Optional. After list.
 * @return null|bool False on WordPress error. Returns null when displaying.
 */
function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '')
{
    $term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
    if (is_wp_error($term_list)) {
        return false;
    }
    /**
     * Filter the list of terms to display.
     *
     * @since 2.9.0
     *
     * @param array  $term_list List of terms to display.
     * @param string $taxonomy  The taxonomy name.
     * @param string $before    String to use before the terms.
     * @param string $sep       String to use between the terms.
     * @param string $after     String to use after the terms.
     */
    echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}

WordPress Version: 3.7

/**
 * Display the terms in a list.
 *
 * @since 2.5.0
 *
 * @param int $id Post ID.
 * @param string $taxonomy Taxonomy name.
 * @param string $before Optional. Before list.
 * @param string $sep Optional. Separate items using this.
 * @param string $after Optional. After list.
 * @return null|bool False on WordPress error. Returns null when displaying.
 */
function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '')
{
    $term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
    if (is_wp_error($term_list)) {
        return false;
    }
    echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}